NEW: Some new scripts
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
Write-Output "Installing PSWindowsUpdate"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
Install-Module PSWindowsUpdate -Force -Confirm:$False
|
||||
|
||||
Write-Output "Running Get-WindowsUpdate"
|
||||
Get-WindowsUpdate -MicrosoftUpdate -Category 'Critical Updates', 'Security Updates' -Verbose
|
||||
|
||||
Write-Output "Running Invoke-WUJob"
|
||||
Invoke-WUJob -Script {ipmo PSWindowsUpdate;Get-WindowsUpdate -Install -MicrosoftUpdate -Category 'Critical Updates', 'Security Updates' -AcceptAll -IgnoreReboot -Verbose | Out-File C:\WindowsUpdate.log} -RunNow -Confirm:$false
|
||||
|
||||
Write-Output "Get-ScheduledTask -TaskName PSWindowsUpdate"
|
||||
Get-ScheduledTask -TaskName PSWindowsUpdate
|
||||
|
||||
Write-Output "(Get-ScheduledTask -TaskName PSWindowsUpdate).Actions"
|
||||
(Get-ScheduledTask -TaskName PSWindowsUpdate).Actions
|
||||
|
||||
Write-Output "Get-ScheduledTaskInfo -TaskName PSWindowsUpdate"
|
||||
Get-ScheduledTaskInfo -TaskName PSWindowsUpdate
|
||||
|
||||
Write-Output "Get-Content C:\WindowsUpdate.log"
|
||||
Get-Content "C:\WindowsUpdate.log"
|
||||
|
||||
Write-Output "Waiting for PSWindowsUpdate Task to Complete"
|
||||
$stopWatch = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
while($true) {
|
||||
$taskStatus = (Get-ScheduledTask -TaskName PSWindowsUpdate).State
|
||||
Write-Output "PSWindowsUpdate Task Status - $taskStatus"
|
||||
|
||||
if ($taskStatus -ne "Ready" ) {
|
||||
$elapsed = "{0:D2}:{1:D2}:{2:D2}" -f $stopWatch.Elapsed.Hours, $stopWatch.Elapsed.Minutes, $stopWatch.Elapsed.Seconds
|
||||
Write-Output "Waiting for completion of task PSWindowsUpdate - $elapsed"
|
||||
Write-Output "Get-Content C:\WindowsUpdate.log"
|
||||
Get-Content "C:\WindowsUpdate.log"
|
||||
Start-Sleep -s 10
|
||||
}
|
||||
else {
|
||||
Write-Output "PSWindowsUpdate Task Completed"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output "Get-Content C:\WindowsUpdate.log"
|
||||
Get-Content "C:\WindowsUpdate.log"
|
||||
$taskStatus = (Get-ScheduledTask -TaskName PSWindowsUpdate).State
|
||||
Write-Output "PSWindowsUpdate Task Status - $taskStatus"
|
||||
Write-Output "Get-WUHistory"
|
||||
Get-WUHistory
|
||||
|
||||
|
||||
Reference in New Issue
Block a user