Bize Ulaşın / Contact Us

Windows Update istemcileri icin script ile kurulumu yaptirmak

16 / 12 / 2011 by WSUS Yorum yok / No Comments

Asagidaki VBScript i konsoldan calistirarak, windows update istemcisinin gerekli guncellemeleri hemen indirmesini, kurmasini ve gerekiyorsa bilgisayari yeniden baslatmasini saglayabilirsiniz.

Set fso = CreateObject(“Scripting.FileSystemObject”)
Set objAutomaticUpdates = CreateObject(“Microsoft.Update.AutoUpdate”)
objAutomaticUpdates.EnableService
objAutomaticUpdates.DetectNow

Set objSession = CreateObject(“Microsoft.Update.Session”)
Set objSearcher = objSession.CreateUpdateSearcher()
Set objResults = objSearcher.Search(“IsInstalled=0 and Type=’Software'”)
Set colUpdates = objResults.Updates
Set objUpdatesToDownload = CreateObject(“Microsoft.Update.UpdateColl”)
intUpdateCount = 0


For i = 0 to colUpdates.Count – 1
intUpdateCount = intUpdateCount + 1
Set objUpdate = colUpdates.Item(i)
objUpdatesToDownload.Add(objUpdate)
Next

If intUpdateCount = 0 Then
WScript.Quit
Else
Set objDownloader = objSession.CreateUpdateDownloader()
objDownloader.Updates = objUpdatesToDownload
objDownloader.Download()

Set objInstaller = objSession.CreateUpdateInstaller()
objInstaller.Updates = objUpdatesToDownload
Set installationResult = objInstaller.Install()

Set objSysInfo = CreateObject(“Microsoft.Update.SystemInfo”)
If objSysInfo.RebootRequired Then
Set objWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate, Shutdown)}!\\localhost\root\cimv2”)
Set colOperatingSystems = objWMIService.ExecQuery(“Select * from Win32_OperatingSystem”)
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next
End If
End If

Kaynak: Best Practices in Architecting and Implementing Windows Server Update Services (WSUS)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*

Kontrol / Control * Time limit is exhausted. Please reload CAPTCHA.