The Ability to Initiate Power Shell Script Actions against Groups in the Deployment Status
I'd like the option to initiate a Power Shell Script from our SCRIPTS tab or a Right Click Tools Action against for example all machines that had a Failure with a Deployment or Status of Unknown.
Example of a script I'd like to be able to run against a machine would be:
net stop wuauserv
net stop bits
net stop cryptsvc
#net stop pla /y
#net stop "sms agent host"
#net stop "security center"
#net stop Winmgmt /y
Start-Sleep -Seconds 10
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientIDValidation /f
mkdir C:\EmptyFolder
robocopy C:\EmptyFolder c:\windows\SoftwareDistribution /mir
robocopy C:\EmptyFolder c:\windows\System32\Catroot2 /mir
rd /s /q "C:\WINDOWS\SoftwareDistribution"
rd /s /q "c:\windows\System32\Catroot2"
rmdir C:\EmptyFolder
Start-Sleep -Seconds 5
net start wuauserv
net start bits
net start cryptsvc
net start Winmgmt
net start "sms agent host"
net start iphlpsvc
net start "security center"
net start pla
wuauclt.exe /resetauthorization /detectnow
write-host "WSUS Folders Cleared"
Remove-Item C:\Windows\System32\GroupPolicy\Machine\Registry.pol -Force
GPUPDATE /FORCE
Invoke-GPUpdate –Computer 127.0.0.1 –RandomDelayInMinutes 0 -Force
$date = (Get-ChildItem C:\Windows\System32\GroupPolicy\Machine\Registry.pol).CreationTime.ToString('ddMMyyyy')
if ($date -ge '20200913') {
Write-Host "Installed"
}