You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring
When using the source 'WindowsUpdate" with xWindowsUpdateAgent resource, the xWindowsUpdate module attempts to disable Microsoft Update setting without first checking to see if that service is registered which throws an exception if that service is not registered. See below dsc output:
Verbose logs showing the problem
VERBOSE: [LOCALHOST]: [[xWindowsUpdateAgent]DirectResourceAccess] Performing the operation "Set-TargetResource" on
VERBOSE: target "Disable Microsoft Update Service".
VERBOSE: [LOCALHOST]: [[xWindowsUpdateAgent]DirectResourceAccess] Disable the Microsoft Update setting
Exception from HRESULT: 0x80248014+ CategoryInfo : OperationStopped: (:) [], CimException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
+ PSComputerName : localhost
0x80248014 WU_E_DS_UNKNOWNSERVICE An operation did not complete because the service is not in the data store.
And when checking the store I can confirm the Microsoft Update service is not registered on this system.
Suggested solution to the issue
It seems like a simply solution might just be to update the Remove-WuaService function to first check if the service being removed is actually registered. Example:
functionRemove-WuaService {
param(
[Parameter(Mandatory=$true)]
[string]
$ServiceId
)
$wuaServiceManager=Get-WuaServiceManager$ServiceIDs=$wuaServiceManager.Services|Select-Object-ExpandProperty Serviceid
if ( $ServiceIDs-notcontains$ServiceId ) {
Write-Verbose"Service id: $ServiceId is not registered."return$null
}
$wuaServiceManager.RemoveService($ServiceId)
}
The DSC configuration that is used to reproduce the issue (as detailed as possible)
# on a system where Microsoft Update is not registered. Invoke-DscResource-Name xWindowsUpdateAgent -ModuleName xWindowsUpdate -Method Set -Property @{
IsSingleInstance='Yes'UpdateNow=$trueCategory=@('Security','Important')
Source='WindowsUpdate'Notifications='ScheduledInstallation'
}
The operating system the target node is running
OsName : Microsoft Windows Server 2012 R2 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 9600.19478.amd64fre.winblue_ltsb.190831-0600
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
Details of the scenario you tried and the problem that is occurring
When using the source 'WindowsUpdate" with xWindowsUpdateAgent resource, the xWindowsUpdate module attempts to disable Microsoft Update setting without first checking to see if that service is registered which throws an exception if that service is not registered. See below dsc output:
Verbose logs showing the problem
Per https://docs.microsoft.com/en-us/windows/deployment/update/windows-update-error-reference, this exception indicates:
And when checking the store I can confirm the Microsoft Update service is not registered on this system.
Suggested solution to the issue
It seems like a simply solution might just be to update the Remove-WuaService function to first check if the service being removed is actually registered. Example:
https://github.com/PowerShell/xWindowsUpdate/blob/b10426e212827ab7a182b6b45f31fb46c9dfa6ae/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1#L27
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
OsName : Microsoft Windows Server 2012 R2 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 9600.19478.amd64fre.winblue_ltsb.190831-0600
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
PSVersion 5.1.14409.1018
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1018
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used ('dev' if using current dev branch)
v2.8.0.0 - master branch
Thanks!
The text was updated successfully, but these errors were encountered: