Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #one time setup. Run the folowing as admin answering Yes to the prompt
- #Install-Module PSWindowsUpdate
- $dt = [DateTime]::Now
- $dt
- $fl="C:\logs\patchserver-{0:M-d-yyyy}.log"-f $dt
- $fl
- get-service W3SVC| Stop-Service 4>&1 |Out-File $fl -Append
- if ((Get-Service W3SVC).Status -eq "Running"){
- Write-Error "IIS still running. Run script again once stopped."4>&1 |Out-File $fl -Append
- exit
- }
- Import-Module PSWindowsUpdate -verbose 4>&1 |Out-File $fl -Append
- write-host "IIS stopped" 4>&1 |Out-File $fl -Append
- write-host "Installing updates" 4>&1 |Out-File $fl -Append
- Get-WUInstall -AcceptAll -Install -AutoReboot -verbose 4>&1 |Out-File $fl -Append
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement