winlin
Goto Top

Windows Updates per Task installieren

In meiner GPO werden WSUS Updates auf den Systemen heruntergeladen und sollen zu einem Wartungsfenster erst installiert werden. Über die wuapp.exe kann ich das per klick machen. Habe versucht mit wuauclt.exe /detectnow und updatenow das ganze zu installieren im Admin CMD Fenster. Wenn ich den Befehl absetze tut sich nicht, auch nach einem Restart steht immernoch die Installation der Updates aus.

was läuft falsch

Content-Key: 289875

Url: https://administrator.de/contentid/289875

Ausgedruckt am: 28.03.2024 um 08:03 Uhr

Mitglied: 122990
122990 02.12.2015 um 13:12:55 Uhr
Goto Top
Mitglied: winlin
winlin 02.12.2015 aktualisiert um 13:27:37 Uhr
Goto Top
kurz ne frage was muss ich im skript ändern damit er einfach installiert ohne userabfrage ob ich das wirklich will oder nicht und dem license agreement?
Mitglied: 122990
Lösung 122990 02.12.2015, aktualisiert am 03.12.2015 um 09:15:53 Uhr
Goto Top
Zitat von @winlin:
kurz ne frage was muss ich im skript ändern damit er einfach installiert ohne userabfrage ob ich das wirklich will oder nicht und dem license agreement?
Das musst du natürlich anpassen, hab mal schnell drüber geschaut und die entsprechenden Stellen entfernt so das es ohne User-Input laufen müsste (ungetestet also ohne Gewähr)
Set updateSession = CreateObject("Microsoft.Update.Session")  
updateSession.ClientApplicationID = "MSDN Sample Script"  

Set updateSearcher = updateSession.CreateUpdateSearcher()

WScript.Echo "Searching for updates..." & vbCRLF  

Set searchResult = _
updateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0")  

WScript.Echo "List of applicable items on the machine:"  

For I = 0 To searchResult.Updates.Count-1
    Set update = searchResult.Updates.Item(I)
    WScript.Echo I + 1 & "> " & update.Title  
Next

If searchResult.Updates.Count = 0 Then
    WScript.Echo "There are no applicable updates."  
    WScript.Quit
End If

WScript.Echo vbCRLF & "Creating collection of updates to download:"  

Set updatesToDownload = CreateObject("Microsoft.Update.UpdateColl")  

For I = 0 to searchResult.Updates.Count-1
    Set update = searchResult.Updates.Item(I)
    addThisUpdate = false
    If update.InstallationBehavior.CanRequestUserInput = true Then
        WScript.Echo I + 1 & "> skipping: " & update.Title & _  
        " because it requires user input"  
    Else
        If update.EulaAccepted = false Then
        	update.AcceptEula()
        End If
        addThisUpdate = true
    End If
    If addThisUpdate = true Then
        WScript.Echo I + 1 & "> adding: " & update.Title   
        updatesToDownload.Add(update)
    End If
Next

If updatesToDownload.Count = 0 Then
    WScript.Echo "All applicable updates were skipped."  
    WScript.Quit
End If
    
WScript.Echo vbCRLF & "Downloading updates..."  

Set downloader = updateSession.CreateUpdateDownloader() 
downloader.Updates = updatesToDownload
downloader.Download()

Set updatesToInstall = CreateObject("Microsoft.Update.UpdateColl")  

rebootMayBeRequired = false

WScript.Echo vbCRLF & "Successfully downloaded updates:"  

For I = 0 To searchResult.Updates.Count-1
    set update = searchResult.Updates.Item(I)
    If update.IsDownloaded = true Then
        WScript.Echo I + 1 & "> " & update.Title   
        updatesToInstall.Add(update) 
        If update.InstallationBehavior.RebootBehavior > 0 Then
            rebootMayBeRequired = true
        End If
    End If
Next

If updatesToInstall.Count = 0 Then
    WScript.Echo "No updates were successfully downloaded."  
    WScript.Quit
End If

If rebootMayBeRequired = true Then
    WScript.Echo vbCRLF & "These updates may require a reboot."  
End If


WScript.Echo "Installing updates..."  
Set installer = updateSession.CreateUpdateInstaller()
installer.Updates = updatesToInstall
Set installationResult = installer.Install()

'Output results of install  
WScript.Echo "Installation Result: " & _  
installationResult.ResultCode 
WScript.Echo "Reboot Required: " & _   
installationResult.RebootRequired & vbCRLF 
WScript.Echo "Listing of updates installed " & _  
"and individual installation results:"   

For I = 0 to updatesToInstall.Count - 1
    WScript.Echo I + 1 & "> " & _  
    updatesToInstall.Item(i).Title & _
    ": " & installationResult.GetUpdateResult(i).ResultCode     
Next
Mitglied: winlin
winlin 03.12.2015 um 09:15:47 Uhr
Goto Top
hast mir echt geholfen - SUPER!!!!
Mitglied: DerWoWusste
Lösung DerWoWusste 03.12.2015, aktualisiert am 12.01.2016 um 19:46:49 Uhr
Goto Top
Schön, dass mal ein Skript geschrieben wurde, grexit!

Wäre natürlich auch interessant, das Windowsupdate.log von wuauclt /updatenow anzusehen, denn das sollte ja auch gehen.