WSUS
4 TopicsKeeping PowerShell up-to-date via WSUS.
Hi, folks. This is a quick one to let any fellow hybrid operators know that PowerShell (as distinct from Windows PowerShell) can be kept up-to-date via WSUS these days. Product and Classifications You can find the PowerShell products listed as shown below, while within the Classifications tab, you want to have the "Updates" category checked. After WSUS synchronisation You'll see it's now aware of the various 7.x branches. After client synchronisation to WSUS You'll see the various updates pending approval for deployment. (Yes, my PowerShell's very old now!) A nice little win for the keeping the small things in (my) life current for zero extra effort. Cheers, Lain445Views2likes0CommentsPowerShell Novice: Script Timeout #WSUS
Hi I'm an idiot. Have to say this at the beginning so you are ready to help a moron understand what is happening!!! And in plain English, or crayon...... I'm trying to schedule a PowerShell script to clean up my WSUS which is proving to be a pain to keep on top of.......little bit of research and I find the following basic script which appears to do what I need, however I get a red warning that this basically times out and then fails in its task. Is my script too basic and I am expecting too much, or can the time frame be increased to allow it to do what it needs to do?! I don't want to pay for the infamous AdamJ script and had hoped WSUS would be developed further by now to accommodate such cleaning tasks....but hey ho! Any help would be most welcome...thanks!! Get-Date >> E:\WSUS_Logs\WSUS_Decline.txt Get-WsusServer | Invoke-WsusServerCleanup -DeclineExpiredUpdates -DeclineSupersededUpdates >>E:\WSUS_Logs\WSUS_Decline.txt and a second script for the following Get-Date >> E:\WSUS_Logs\WSUS_Cleanup.txt Get-WsusServer | Invoke-WsusServerCleanup -CleanupObsoleteComputers -CleanupObsoleteUpdates -CleanupUnneededContentFiles >>E:\WSUS_Logs\WSUS_Cleanup.txt2.7KViews0likes7CommentsPulling information from WSUS
I want to refine the results of this command for pulling information from our WSUS server. Get-WSUSComputer | Select-Object FullDomainName,IPAddress,Make,Model,OSArchitecture,OSDescription,ClientVersion -ExpandProperty "BiosInfo" | Where {$_.OSDescription -like "*windows 7*"} | export-csv C:\temp\win7.csv The -ExpandProperty "BiosInfo" creates the following columns: Version Name ReleaseDate FirmwareVersion MobileOperator I want to see only the 'Version'. I can live with the results of the command I'm using, but I'm hoping I can trim the output so I don't have to manually edit the resulting .csv .2.9KViews0likes2CommentsPowerShell ile WSUS kurulum ve yapılandırması (tr-TR)
Bu yazımda sizlere WSUS (Windows Server Update Services) bahsedeceğim. WSUS ile kendi yapınızda Windows serverlar için kendi update sunucunuzu yapılandırabilir ve bu sunucu üzerinden Microsoft ürünü kullandığınız işletim sistemlerini ve Microsoft yazılımlarını güncelleyebilirsiniz. PowerShell ile kurulum ve yapilandırmasını yapacağımız WSUS için detayları aşağıda bulabilirsiniz. Öncesinde bazı detaylardan bağsetmek isterim. WSUS normal şartlarda kolay kurulan ve yönetilen bir servistir ancak çok ilgi ister. Her gün kontrol edilmeli yada anlık olarak monitor edilmelidir. Günlük yayınlanan defender güncelllemeleri onaylanmalı yada otomatik olarak kurallaştırılarak onaylanması sağlanmalıdır. Aylık yayınlanan major ve minor Windows updateleri için incelemeler yapılmalı ve kontrollü bir şekilde uygulanmalıdır. Kurulum yapacağınız Windows Server domain join durumda yada workgroup olarak çalışan bir sunucu olabilir. Önerilen mimarilerde genelde Domain yapısında olması yönetim kolaylığı açısından tervcih edilemektedir. Ancak Workgroup olarakda sorunsuz çalışmaktadır. Kurulum için Windows Server işletim sistemimizde PowerShell'i administrator olarak çalıştırarak başlıyoruz. Install-WindowsFeature kurulum komutu ile iligli servisimiz WSUS için isim tanımlası ve yönetim araçlarını yüklemek için gerekli tanımlamaları aşağıdaki şekilde komutuma yazarak işlemlerime başlıyorum. Install-WindowsFeature UpdateServices -IncludeManagementTools Komut çıktısı: Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. PS C:\Users\Administrator> Install-WindowsFeature UpdateServices -IncludeManagementTools Success Restart Needed Exit Code Feature Result ------- -------------- --------- -------------- True No Success {ASP.NET 4.7, HTTP Activation, Remote Serv... WARNING: Additional configuration may be required. Review the article Managing WSUS Using PowerShell at TechNet Library (http://go.microsoft.com/fwlink/?LinkId=235499) for more information on the recommended steps to perform WSUS installation using PowerShell. Kurulum işlemimiz tamamlanmıştır. Yapılandırma işlemleri için aşağıdaki PowerShell scripti size yardımcı olacaktır. ### WUSUS post-deplpyment yapilandirma ayarlari . "C:\Program Files\Update Services\Tools\WsusUtil.exe" postinstall CONTENT_DIR=C:\WSUS ### WSUS nesnesinin tanımlanması $wsus = Get-WSUSServer ### WSUS yapilandirma tanimlamasi $wsusConfig = $wsus.GetConfiguration() ### Microsoft güncellemelerinin yapilandirilamsi Set-WsusServerSynchronization –SyncFromMU ### Güncelleme paketi dil tanımlaması sadece ingilizce yapilandirilmisiti bu bölümde istediğiniz dilleri virgul ekleyerek kısa kodunu yazabilirsiniz. $wsusConfig.AllUpdateLanguagesEnabled = $false $wsusConfig.SetEnabledUpdateLanguages("en") $wsusConfig.Save() ### WSUS ve Microsoft güncelleme SYNC tanimlamasi $wsus.GetSubscription().StartSynchronizationForCategoryOnly() start-sleep 15 ### SYNC tanimlamasi while ($wsus.GetSubscription().GetSynchronizationStatus() -ne "NotProcessing") { $time = get-date -UFormat "%H:%M:%S" $total = $wsus.GetSubscription().getsynchronizationprogress().totalitems $processed = $wsus.GetSubscription().getsynchronizationprogress().processeditems $process = $processed/$total $progress = "{0:P0}" -f $process Write-Host "" Write-Host "The first synchronization isn't completed yet $time" Write-Host "Kindly have patience, the progress is $progress" Start-Sleep 10 } Write-Host "The synchronization has completed at $time" -ForegroundColor Green Write-Host "The WSUS Configuration will now continue" -ForegroundColor Green ### Guncelleme urunlerinin tanimlanmasi, bu bolumu genisletebilrisiniz. Ben örnek için sadece Windows Server 2019 ekledim scritpti genisleterek diger urunleride ekleyebilirsiniz. write-host 'Setting WSUS Products' Get-WsusProduct | where-Object { $_.Product.Title -in ( 'Windows Server 2019') } | Set-WsusProduct ### Guncelleme sinfilarinin tanimlanmasi yine bu bolumde de siniflari arttirabilir yada azaltabilirsiniz. write-host 'Setting WSUS Classifications' Get-WsusClassification | Where-Object { $_.Classification.Title -in ( 'Critical Updates', 'Definition Updates', 'Feature Packs', 'Security Updates', 'Service Packs', 'Update Rollups', 'Updates') } | Set-WsusClassification ### SYNC yapilandirmasi write-host 'Enabling WSUS Automatic Synchronisation' $subscription = $wsus.GetSubscription() $subscription.SynchronizeAutomatically=$true ### otomatik sync yapilandirmasi $subscription.SynchronizeAutomaticallyTimeOfDay= (New-TimeSpan -Hours 0) $subscription.NumberOfSynchronizationsPerDay=1 $subscription.Save() ### Guncellenecek hedef grubun belirlenmesi $wsus.CreateComputerTargetGroup("Updates") ### Guncelleme paketlerinin onaylanmasi write-host 'Configuring default automatic approval rule' [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") $rule = $wsus.GetInstallApprovalRules() | Where { $_.Name -eq "Default Automatic Approval Rule"} $class = $wsus.GetUpdateClassifications() | ? {$_.Title -In ( 'Critical Updates', 'Security Updates')} $class_coll = New-Object Microsoft.UpdateServices.Administration.UpdateClassificationCollection $class_coll.AddRange($class) $rule.SetUpdateClassifications($class_coll) $rule.Enabled = $True $rule.Save() ### Computer groupların güncelleme islemi $wsusConfig.OobeInitialized = $true $wsusConfig.Save() ### SYNC baslamasi $wsus.GetSubscription().StartSynchronization() Uygulama ekran görüntüleri: Windows Server Update Services açarsanız Overview ekranından yaptığımız işlemleri çapraz kontrolünü yapabilirsiniz. WSUS ile client ve server istemcilerinizi update etmek için; İstemcileri (Windows server işlerim sistemleri ve client işletim sistemlerini) WSUS'a ekleyerek güncellemelerini tek bir sunucu üzerinden kontrol ederek hangi sunucuda hangi güncelleme eksik yada hangi sunucunun güncellemeleri tamamlanmış görebiliyoruz. İstemci sistemi WSUS üzerinden güncellemek için aşağıdaki adımları yapmanız gerekmektedir. Bu işlemleri AD DS üzerinden policy olarak oluşturup tüm DC yapınızdaki bilgisayarları gruplayıp güncelleme servisini güncelleyebilirsiniz. Windows Update servisini WSUS üzerinde yapilandirmak için aşağıdaki işlemler iuygulayabilirsiniz. İlk olarak GPEDIT.msc (Local Group Policy Editor) gidiyoruz. Bu adımda WSUS sunucusuna istemciyi eklememiz için GPleri kullanıyoruz. Windows update server olarak WSUS'u göstereceğiz. Local Group Policy Editorumuz açıldığında aşağıdaki pencereyi görüntüleyeceksiniz. Local Computer Policy > Computer Configuration > Administrative Templates > Windows Components > Winows Update dizinine gidiyoruz. Windows Update Dizininde "Specify intranet Microsoft update service locaition" politikasını buluyoruz. Specify intranet Microsoft update service locaition çift tıklayara giriş yapıyoruz. Gördüğünüz gibi not configured şeklinde gözükmektedir. Bu politikayı aktif duruma getirmek için enabled konumuna getiriyoruz. Enabled ettikten sonra alt bölümde "set the intranet update service for detecting updates" ve "set the intranet statistics server" bölümlerine Vargonen olarak kullandığımız WSUS serverin bilgilerini giriyorsunuz. WSUS bilgisi: ht target=_blank target=_blank target=_blank target=_blanktp://192.168.2.212:8530 (işlem sürecinde wsus adresini FQDN olarak tanımlayıp gerekli dns yapılandırmasını yapıp kullanmanızı tavsiye ederim yarın IP adresini değiştirmek zorunda kalırsanız FQDN adresinin IP bilgisini değiştirmeniz yeterli olacaktır. .) Politikamızı aktif ettikten sonra aktif olduğunu kontrol etmek için Control Panel > Windows Update dizinine gidiniz. You receive updates: Managed by your system administrator şeklinde bir bölüm göreceksiniz. Bu WSUS üzerinden güncelleme aldığını gösteren bir uyardır. Özel durumlarda (Örneğin: WSUS çalışmadığında) "Check online for updates from Microsoft Update" linkine tıklayınız, güncellemeleriniz Microsoft update servisleri üzerinden online olarak indirilecektir. Güncellemeleri yüklemek ve kontrol etmek için check for updates linkine tıklayınız Çapraz kontrol için WSUS sunucusu üzerinden kontrol ediniz WSUS erişim bilgileriniz yok ise ilgili sistem yöneticinize başvurunuz. Sunucumuz başarı ile WSUS üzerine eklenmiş ve güncellemeleri tamamlanmış olduğunu göreceksiniz. Sunucunuz WSUS üzerinde gözükmüyor yada güncellemeleri yaptınız ve güncellemeler yüklü gözükmüyor ise aşağıdaki komutları çalıştırınız. Not: Komutlar komut satırı yada powershell de çalışmaktadır herhangi birinde bu işlemi gerçekleştirebilirsiniz. wuauclt.exe /resetauthorization /detectnow komutunu çalıştırıyoruz. wuauclt.exe /resetauthorization /detectnow İşle sonucu ekrana çıktı vermeyecektir. 5 dk sonra WSUS üzerinden tekrar kontrol ediniz. Kaynak: docs.microsoft.com Kaynak: spiceworks.com1.3KViews5likes0Comments