Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xWindowsUpdateAgent: 0x80248014 when disabling Microsoft Update Setting #90

Open
Geogboe opened this issue Oct 21, 2019 · 0 comments
Open
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@Geogboe
Copy link

Geogboe commented Oct 21, 2019

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 

Per https://docs.microsoft.com/en-us/windows/deployment/update/windows-update-error-reference, this exception indicates:

 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:

https://github.com/PowerShell/xWindowsUpdate/blob/b10426e212827ab7a182b6b45f31fb46c9dfa6ae/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1#L27

function Remove-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        = $true
    Category         = @('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

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!

@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants