Create Task sequence and add the below Script and deploy it silently.
Scan Error : Unable to read existing WUA Group Policy object. Error = 0x80004005.
Below is the fix
Function Write-log
{
Param(
[Parameter(position=0)]
$msg = " ",
$log ="C:\windows\ccm\logs\RenamingRegPol.log"
)
Add-Content -Path $log -Value ((Get-Date -Format "yyyy-MM-dd hh:mm:ss") + " " + $msg)
}
try{
Write-log "-----------------------------------------------"
Write-log "Script Started"
Write-log "Renaming Reg.pol file "
if (Test-Path -Path C:\Windows\System32\GroupPolicy\Machine\_Registry.pol)
{
Remove-Item "C:\Windows\System32\GroupPolicy\Machine\_Registry.pol" -Force -ErrorAction Stop
}
Rename-Item -Path C:\Windows\System32\GroupPolicy\Machine\Registry.pol -NewName "_Registry.pol" -ErrorAction Stop
Write-log "Renamed Reg.pol file "
Write-log "Running GP update on the machine "
gpupdate /force
Write-log "Ran GP update on the machine "
}
Catch{
Write-log $($_.exception.message)
}
Write-log "Waiting for 120 seconds"
Start-Sleep 120
Write-log "Refreshing Machine Policy"
Invoke-WmiMethod -Namespace root\ccm -Class SMS_Client -Name TriggerSchedule "{00000000-0000-0000-0000-000000000021}"
Write-log "Waiting for 60 seconds"
Start-Sleep 60
Write-log "Evaluating Machine Policy"
Invoke-WmiMethod -Namespace root\ccm -Class SMS_Client -Name TriggerSchedule "{00000000-0000-0000-0000-000000000022}"
Write-log "Waiting for 60 seconds"
Start-Sleep 60
Write-log "Initiating Scan Cycle"
Invoke-WmiMethod -Namespace root\ccm -Class SMS_Client -Name TriggerSchedule "{00000000-0000-0000-0000-000000000113}"
Write-log "Waiting for 180 seconds"
Start-Sleep 180
Write-log "Initiating Update Deployment Cycle"
Invoke-WmiMethod -Namespace root\ccm -Class SMS_Client -Name TriggerSchedule "{00000000-0000-0000-0000-000000000108}"
Write-log "Waiting for 60 seconds"
Start-Sleep 60
Write-log "Script Completed "
Write-log "-----------------------------------------------"