Skip to content

Instantly share code, notes, and snippets.

@systemcenterblog
Last active September 8, 2023 18:41
Show Gist options
  • Save systemcenterblog/84ae696c69ff546e5100fc75ec04bbae to your computer and use it in GitHub Desktop.
Save systemcenterblog/84ae696c69ff546e5100fc75ec04bbae to your computer and use it in GitHub Desktop.
Job error (0x80004005) Unable to read existing WUA Group Policy object
<#
Script Disclaimer: The sample scripts provided here are not supported under any Microsoft standard support program or service.
All scripts are provided AS IS without warranty of any kind.
ERRORS:
UpdatesDeployment.log
Job error (0x80004005) received for assignment ({bf7a48e6-d220-4070-bb9b-ecc239107584}) action UpdatesDeploymentAgent 12/6/2017 10:32:27 AM 2096 (0x0830)
WUAHandler.log
Unable to read existing WUA Group Policy object. Error = 0x80004005. WUAHandler 12/6/2017 3:41:00 AM 2828 (0x0B0C)
Failed to Add Update Source for WUAgent of type (2) and id ({3AAB6A76-CE2D-4E8A-9F11-741AE69677A2}). Error = 0x80004005. WUAHandler 12/6/2017 11:03:31 AM 2276 (0x08E4)
Author:
Twitter @Syswow64blog
Web: systemcenterblog.co.uk
#>
$Registrypol= (TEST-PATH C:\Windows\System32\GroupPolicy\Machine\Registry.pol)
$RegistrypolOLD= (TEST-PATH C:\Windows\System32\GroupPolicy\Machine\Registry.pol.OLD)
$commentcmtx=(TEST-PATH C:\Windows\System32\GroupPolicy\Machine\comment.cmtx)
$commentcmtxOLD=(TEST-PATH C:\Windows\System32\GroupPolicy\Machine\comment.cmtx.OLD)
$SOFTWAREDISTRIBUTIONOLD=(TEST-PATH C:\Windows\SOFTWAREDISTRIBUTION.OLD)
GET-SERVICE -NAME WUAUSERV | STOP-SERVICE
IF($Registrypol)
{
write-host "Registrypol = true"
IF(!($RegistrypolOLD))
{
write-host "RegistrypolOLD = FALSE"
Rename-item -path "C:\Windows\System32\GroupPolicy\Machine\Registry.pol" -newname "Registry.pol.OLD"
}
}
IF($commentcmtx)
{
write-host "commentcmtx = true"
IF(!($commentcmtxOLD))
{
write-host "commentcmtxOLD = FALSE"
Rename-item -path "C:\Windows\System32\GroupPolicy\Machine\comment.cmtx" -newname "comment.cmtx.OLD"
}
}
IF(!($SOFTWAREDISTRIBUTIONOLD))
{
write-host "SOFTWAREDISTRIBUTIONOLD = false"
Rename-Item -path "C:\Windows\SOFTWAREDISTRIBUTION" -newname "SOFTWAREDISTRIBUTION.OLD"
#Remove-Item C:\Windows\SOFTWAREDISTRIBUTION -Force -Recurse
#New-Item C:\Windows\SOFTWAREDISTRIBUTION.OLD
}
GET-SERVICE -NAME WUAUSERV | START-SERVICE
Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule "{00000000-0000-0000-0000-000000000021}" #Request Machine Assignments
Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule "{00000000-0000-0000-0000-000000000022}" #Evaluate Machine Policies
Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule "{00000000-0000-0000-0000-000000000113}" #Scan by Update Source
Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule "{00000000-0000-0000-0000-000000000108}" #Software Updates Assignments Evaluation Cycle
@mtariqkhanIT
Copy link

The above script worked for me. Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment