Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Automatisch WSUS Updates installieren

$
0
0

Hallo,

ich möchte folgendes Script über die Aufgabenplanung starten. Dies funktioniert mit meinem Account (lokaler Admin). Jetzt möchte ich es mittels Dienst-Konto starten. Das Dienstkonto soll aber nicht unbedingt die Rolle lokaler Admin bekommen. Welche Rechte benötigt das Dienstkonto um folgendes Script ausführen zu können?

try{
#Define update criteria.
$Criteria = "IsInstalled=0 and Type='Software'"

#Search for relevant updates.
$Searcher = New-Object -ComObject Microsoft.Update.Searcher
$SearchResult = $Searcher.Search($Criteria).Updates

#Download updates.
$Session = New-Object -ComObject Microsoft.Update.Session
$Downloader = $Session.CreateUpdateDownloader()
$Downloader.Updates = $SearchResult
$Downloader.Download()

#Install updates.
$Installer = New-Object -ComObject Microsoft.Update.Installer
$Installer.Updates = $SearchResult
$Result = $Installer.Install()

#Reboot if required by updates.
If ($Result.rebootRequired) { shutdown.exe /t 0 /r }

}catch{
  $logSrc="atWsusUpdInstaller"
  Write-EventLog -LogName Application -source $logSrc -EntryType Error -EventId $error.Count -message "$PSItem"
}


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>