Intune Initial Scripts Backup
This commit is contained in:
15
dump/WSUS_Scripts/Backups/new-WSUS-PendingReboot.ps1
Normal file
15
dump/WSUS_Scripts/Backups/new-WSUS-PendingReboot.ps1
Normal file
@@ -0,0 +1,15 @@
|
||||
#import correct file
|
||||
#Uncomment Restart-Computer
|
||||
|
||||
$Server_Reboot_Before_Patching = Import-Csv E:\WSUS_Scripts\Files\PENDING-Reboots-10-08-2019.csv | ? { $_.RebootPending -eq "True" } | select computer
|
||||
|
||||
$Server_Reboot_Before_Patching.Computer | % {
|
||||
Write-EventLog -LogName System -Source "Powershell-WSUS-Reboot-Before-Patching" -EntryType Information -EventId 7893 -Message "Reboot-Before-Patching-Remote" -ErrorAction SilentlyContinue
|
||||
Invoke-Command $_ -ErrorAction SilentlyContinue {
|
||||
New-EventLog -LogName System -Source "Reboot-Before-Patching" -ErrorAction SilentlyContinue
|
||||
Write-EventLog -LogName System -Source "Reboot-Before-Patching" -EntryType Information -EventId 7893 -Message "Reboot-Before-Patching-Invoke" -ErrorAction SilentlyContinue
|
||||
}#endInvoke
|
||||
Restart-Computer $_ -Force -Verbose
|
||||
}#end%
|
||||
|
||||
|
||||
Reference in New Issue
Block a user