Tag Archive: WSUS scan

SCCM Report / SQL Query – Troubleshooting Software Update scan errors

SCCM has a built-in report displaying all scan errors reported by the Software Updates component.  This is very useful if you want to determine if there is a common error for multiple devices i.e. group policy conflicts or update scan timeout.  This report is found under the “Software Updates – E Troubleshooting” category under the default reports.  The report I would like to discuss is the one called “Troubleshooting 1 – Scan errors”.  This report will typically show you an error code, Hex error code, error description and a count of the devices with the specific error.  However none of the error codes or the error descriptions are very user-friendly so you always end up searching the internet for the meaning of each error code.

To make this report easier for me to read I decided to include custom descriptive values for most of the error codes. I used values from several sources on the internet, but mostly from the Windows Update error code list as published by Microsoft.  The following query will work on SCCM 2012.  It is quite a lengthy query and there is text wrapping so make sure you select the full query.

select
ErrorStatusID = uss.LastStatusMessageID&0x0000FFFF,
Status = asi.MessageName,
ErrorCode = isnull(uss.LastErrorCode,0),
dbo.fnConvertBinaryToHexString(convert(VARBINARY(8), isnull(uss.LastErrorCode,0))) as HexErrorCode,
‘ErrorText’ =
CASE dbo.fnConvertBinaryToHexString(convert(VARBINARY(8), isnull(uss.LastErrorCode,0)))
WHEN ‘80240001’ THEN ‘WU_E_NO_SERVICE Windows Update Agent was unable to provide the service.’
WHEN ‘80240002’ THEN ‘WU_E_MAX_CAPACITY_REACHED The maximum capacity of the service was exceeded.’
WHEN ‘80240003’ THEN ‘WU_E_UNKNOWN_ID An ID cannot be found.’
WHEN ‘80240004’ THEN ‘WU_E_NOT_INITIALIZED The object could not be initialized.’
WHEN ‘80240005’ THEN ‘WU_E_RANGEOVERLAP The update handler requested a byte range overlapping a previously requested range.’
WHEN ‘80240006’ THEN ‘WU_E_TOOMANYRANGES The requested number of byte ranges exceeds the maximum number (2^31 – 1).’
WHEN ‘80240007’ THEN ‘WU_E_INVALIDINDEX The index to a collection was invalid.’
WHEN ‘80240008’ THEN ‘WU_E_ITEMNOTFOUND The key for the item queried could not be found.’
WHEN ‘80240009’ THEN ‘WU_E_OPERATIONINPROGRESS Another conflicting operation was in progress. Some operations such as installation cannot be performed twice simultaneously.’
WHEN ‘8024000A’ THEN ‘WU_E_COULDNOTCANCEL Cancellation of the operation was not allowed.’
WHEN ‘8024000B’ THEN ‘WU_E_CALL_CANCELLED Operation was cancelled.’
WHEN ‘8024000C’ THEN ‘WU_E_NOOP No operation was required.’
WHEN ‘8024000D’ THEN ‘WU_E_XML_MISSINGDATA Windows Update Agent could not find required information in the update”s XML data.’
WHEN ‘8024000E’ THEN ‘WU_E_XML_INVALID Windows Update Agent found invalid information in the update”s XML data.’
WHEN ‘8024000F’ THEN ‘WU_E_CYCLE_DETECTED Circular update relationships were detected in the metadata.’
WHEN ‘80240010’ THEN ‘WU_E_TOO_DEEP_RELATION Update relationships too deep to evaluate were evaluated.’
WHEN ‘80240011’ THEN ‘WU_E_INVALID_RELATIONSHIP An invalid update relationship was detected.’
WHEN ‘80240012’ THEN ‘WU_E_REG_VALUE_INVALID An invalid registry value was read.’
WHEN ‘80240013’ THEN ‘WU_E_DUPLICATE_ITEM Operation tried to add a duplicate item to a list.’
WHEN ‘80240016’ THEN ‘WU_E_INSTALL_NOT_ALLOWED Operation tried to install while another installation was in progress or the system was pending a mandatory restart.’
WHEN ‘80240017’ THEN ‘WU_E_NOT_APPLICABLE Operation was not performed because there are no applicable updates.’
WHEN ‘80240018’ THEN ‘WU_E_NO_USERTOKEN Operation failed because a required user token is missing.’
WHEN ‘80240019’ THEN ‘WU_E_EXCLUSIVE_INSTALL_CONFLICT An exclusive update cannot be installed with other updates at the same time.’
WHEN ‘8024001A’ THEN ‘WU_E_POLICY_NOT_SET A policy value was not set.’
WHEN ‘8024001B’ THEN ‘WU_E_SELFUPDATE_IN_PROGRESS The operation could not be performed because the Windows Update Agent is self-updating.’
WHEN ‘8024001D’ THEN ‘WU_E_INVALID_UPDATE An update contains invalid metadata.’
WHEN ‘8024001E’ THEN ‘WU_E_SERVICE_STOP Operation did not complete because the service or system was being shut down.’
WHEN ‘8024001F’ THEN ‘WU_E_NO_CONNECTION Operation did not complete because the network connection was unavailable.’
WHEN ‘80240020’ THEN ‘WU_E_NO_INTERACTIVE_USER Operation did not complete because there is no logged-on interactive user.’
WHEN ‘80240021’ THEN ‘WU_E_TIME_OUT Operation did not complete because it timed out.’
WHEN ‘80240022’ THEN ‘WU_E_ALL_UPDATES_FAILED Operation failed for all the updates.’
WHEN ‘80240023’ THEN ‘WU_E_EULAS_DECLINED The license terms for all updates were declined.’
WHEN ‘80240024’ THEN ‘WU_E_NO_UPDATE There are no updates.’
WHEN ‘80240025’ THEN ‘WU_E_USER_ACCESS_DISABLED Group Policy settings prevented access to Windows Update.’
WHEN ‘80240026’ THEN ‘WU_E_INVALID_UPDATE_TYPE The type of update is invalid.’
WHEN ‘80240027’ THEN ‘WU_E_URL_TOO_LONG The URL exceeded the maximum length.’
WHEN ‘80240028’ THEN ‘WU_E_UNINSTALL_NOT_ALLOWED The update could not be uninstalled because the request did not originate from a WSUS server.’
WHEN ‘80240029’ THEN ‘WU_E_INVALID_PRODUCT_LICENSE Search may have missed some updates before there is an unlicensed application on the system.’
WHEN ‘8024002A’ THEN ‘WU_E_MISSING_HANDLER A component required to detect applicable updates was missing.’
WHEN ‘8024002B’ THEN ‘WU_E_LEGACYSERVER An operation did not complete because it requires a newer version of server.’
WHEN ‘8024002C’ THEN ‘WU_E_BIN_SOURCE_ABSENT A delta-compressed update could not be installed because it required the source.’
WHEN ‘8024002D’ THEN ‘WU_E_SOURCE_ABSENT A full-file update could not be installed because it required the source.’
WHEN ‘8024002E’ THEN ‘WU_E_WU_DISABLED Access to an unmanaged server is not allowed.’
WHEN ‘8024002F’ THEN ‘WU_E_CALL_CANCELLED_BY_POLICY Operation did not complete because the DisableWindowsUpdateAccess policy was set.’
WHEN ‘80240030’ THEN ‘WU_E_INVALID_PROXY_SERVER The format of the proxy list was invalid.’
WHEN ‘80240031’ THEN ‘WU_E_INVALID_FILE The file is in the wrong format.’
WHEN ‘80240032’ THEN ‘WU_E_INVALID_CRITERIA The search criteria string was invalid.’
WHEN ‘80240033’ THEN ‘WU_E_EULA_UNAVAILABLE License terms could not be downloaded.’
WHEN ‘80240034’ THEN ‘WU_E_DOWNLOAD_FAILED Update failed to download.’
WHEN ‘80240035’ THEN ‘WU_E_UPDATE_NOT_PROCESSED The update was not processed.’
WHEN ‘80240036’ THEN ‘WU_E_INVALID_OPERATION The object”s current state did not allow the operation.’
WHEN ‘80240037’ THEN ‘WU_E_NOT_SUPPORTED The functionality for the operation is not supported.’
WHEN ‘80240038’ THEN ‘WU_E_WINHTTP_INVALID_FILE The downloaded file has an unexpected content type.’
WHEN ‘80240039’ THEN ‘WU_E_TOO_MANY_RESYNC Agent is asked by server to resync too many times.’
WHEN ‘80240040’ THEN ‘WU_E_NO_SERVER_CORE_SUPPORT WUA API method does not run on Server Core installation.’
WHEN ‘80240041’ THEN ‘WU_E_SYSPREP_IN_PROGRESS Service is not available while sysprep is running.’
WHEN ‘80240042’ THEN ‘WU_E_UNKNOWN_SERVICE The update service is no longer registered with AU.’
WHEN ‘80240FFF’ THEN ‘WU_E_UNEXPECTED An operation failed due to reasons not covered by another error code.’
WHEN ‘80241001’ THEN ‘WU_E_MSI_WRONG_VERSION Search may have missed some updates because the Windows Installer is less than version 3.1.’
WHEN ‘80241002’ THEN ‘WU_E_MSI_NOT_CONFIGURED Search may have missed some updates because the Windows Installer is not configured.’
WHEN ‘80241003’ THEN ‘WU_E_MSP_DISABLED Search may have missed some updates because policy has disabled Windows Installer patching.’
WHEN ‘80241004’ THEN ‘WU_E_MSI_WRONG_APP_CONTEXT An update could not be applied because the application is installed per-user.’
WHEN ‘80241FFF’ THEN ‘WU_E_MSP_UNEXPECTED Search may have missed some updates because there was a failure of the Windows Installer.’
WHEN ‘80244000’ THEN ‘WU_E_PT_SOAPCLIENT_BASE WU_E_PT_SOAPCLIENT_* error codes map to the SOAPCLIENT_ERROR enum of the ATL Server Library.’
WHEN ‘80244001’ THEN ‘WU_E_PT_SOAPCLIENT_INITIALIZE Same as SOAPCLIENT_INITIALIZE_ERROR – initialization of the SOAP client failed, possibly because of an MSXML installation failure.’
WHEN ‘80244002’ THEN ‘WU_E_PT_SOAPCLIENT_OUTOFMEMORY Same as SOAPCLIENT_OUTOFMEMORY – SOAP client failed because it ran out of memory.’
WHEN ‘80244003’ THEN ‘WU_E_PT_SOAPCLIENT_GENERATE Same as SOAPCLIENT_GENERATE_ERROR – SOAP client failed to generate the request.’
WHEN ‘80244004’ THEN ‘WU_E_PT_SOAPCLIENT_CONNECT Same as SOAPCLIENT_CONNECT_ERROR – SOAP client failed to connect to the server.’
WHEN ‘80244005’ THEN ‘WU_E_PT_SOAPCLIENT_SEND Same as SOAPCLIENT_SEND_ERROR – SOAP client failed to send a message for reasons of WU_E_WINHTTP_* error codes.’
WHEN ‘80244006’ THEN ‘WU_E_PT_SOAPCLIENT_SERVER Same as SOAPCLIENT_SERVER_ERROR – SOAP client failed because there was a server error.’
WHEN ‘80244007’ THEN ‘WU_E_PT_SOAPCLIENT_SOAPFAULT Same as SOAPCLIENT_SOAPFAULT – SOAP client failed because there was a SOAP fault for reasons of WU_E_PT_SOAP_* error codes.’
WHEN ‘80244008’ THEN ‘WU_E_PT_SOAPCLIENT_PARSEFAULT Same as SOAPCLIENT_PARSEFAULT_ERROR – SOAP client failed to parse a SOAP fault.’
WHEN ‘80244009’ THEN ‘WU_E_PT_SOAPCLIENT_READ Same as SOAPCLIENT_READ_ERROR – SOAP client failed while reading the response from the server.’
WHEN ‘8024400A’ THEN ‘WU_E_PT_SOAPCLIENT_PARSE Same as SOAPCLIENT_PARSE_ERROR – SOAP client failed to parse the response from the server.’
WHEN ‘8024400B’ THEN ‘WU_E_PT_SOAP_VERSION Same as SOAP_E_VERSION_MISMATCH – SOAP client found an unrecognizable namespace for the SOAP envelope.’
WHEN ‘8024400C’ THEN ‘WU_E_PT_SOAP_MUST_UNDERSTAND Same as SOAP_E_MUST_UNDERSTAND – SOAP client was unable to understand a header.’
WHEN ‘8024400D’ THEN ‘WU_E_PT_SOAP_CLIENT Same as SOAP_E_CLIENT – SOAP client found the message was malformed; fix before resending.’
WHEN ‘8024400E’ THEN ‘WU_E_PT_SOAP_SERVER Same as SOAP_E_SERVER – The SOAP message could not be processed due to a server error; resend later.’
WHEN ‘8024400F’ THEN ‘WU_E_PT_WMI_ERROR There was an unspecified Windows Management Instrumentation (WMI) error.’
WHEN ‘80244010’ THEN ‘WU_E_PT_EXCEEDED_MAX_SERVER_TRIPS The number of round trips to the server exceeded the maximum limit.’
WHEN ‘80244011’ THEN ‘WU_E_PT_SUS_SERVER_NOT_SET WUServer policy value is missing in the registry.’
WHEN ‘80244012’ THEN ‘WU_E_PT_DOUBLE_INITIALIZATION Initialization failed because the object was already initialized.’
WHEN ‘80244013’ THEN ‘WU_E_PT_INVALID_COMPUTER_NAME The computer name could not be determined.’
WHEN ‘80244014’ THEN ‘WU_E_PT_INVALID_COMPUTER_LSID Cannot determine computer LSID.’
WHEN ‘80244015’ THEN ‘WU_E_PT_REFRESH_CACHE_REQUIRED The reply from the server indicates that the server was changed or the cookie was invalid; refresh the state of the internal cache and retry.’
WHEN ‘80244016’ THEN ‘WU_E_PT_HTTP_STATUS_BAD_REQUEST Same as HTTP status 400 – the server could not process the request due to invalid syntax.’
WHEN ‘80244017’ THEN ‘WU_E_PT_HTTP_STATUS_DENIED Same as HTTP status 401 – the requested resource requires user authentication.’
WHEN ‘80244018’ THEN ‘WU_E_PT_HTTP_STATUS_FORBIDDEN Same as HTTP status 403 – server understood the request, but declined to fulfill it.’
WHEN ‘80244019’ THEN ‘WU_E_PT_HTTP_STATUS_NOT_FOUND Same as HTTP status 404 – the server cannot find the requested URI (Uniform Resource Identifier)’
WHEN ‘8024401A’ THEN ‘WU_E_PT_HTTP_STATUS_BAD_METHOD Same as HTTP status 405 – the HTTP method is not allowed.’
WHEN ‘8024401B’ THEN ‘WU_E_PT_HTTP_STATUS_PROXY_AUTH_REQ Same as HTTP status 407 – proxy authentication is required.’
WHEN ‘8024401C’ THEN ‘WU_E_PT_HTTP_STATUS_REQUEST_TIMEOUT Same as HTTP status 408 – the server timed out waiting for the request.’
WHEN ‘8024401D’ THEN ‘WU_E_PT_HTTP_STATUS_CONFLICT Same as HTTP status 409 – the request was not completed due to a conflict with the current state of the resource.’
WHEN ‘8024401E’ THEN ‘WU_E_PT_HTTP_STATUS_GONE Same as HTTP status 410 – requested resource is no longer available at the server.’
WHEN ‘8024401F’ THEN ‘WU_E_PT_HTTP_STATUS_SERVER_ERROR Same as HTTP status 500 – an error internal to the server prevented fulfilling the request.’
WHEN ‘80244020’ THEN ‘WU_E_PT_HTTP_STATUS_NOT_SUPPORTED Same as HTTP status 500 – server does not support the functionality required to fulfill the request.’
WHEN ‘80244021’ THEN ‘WU_E_PT_HTTP_STATUS_BAD_GATEWAY Same as HTTP status 502 – the server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.’
WHEN ‘80244022’ THEN ‘WU_E_PT_HTTP_STATUS_SERVICE_UNAVAIL Same as HTTP status 503 – the service is temporarily overloaded.’
WHEN ‘80244023’ THEN ‘WU_E_PT_HTTP_STATUS_GATEWAY_TIMEOUT Same as HTTP status 503 – the request was timed out waiting for a gateway.’
WHEN ‘80244024’ THEN ‘WU_E_PT_HTTP_STATUS_VERSION_NOT_SUP Same as HTTP status 505 – the server does not support the HTTP protocol version used for the request.’
WHEN ‘80244025’ THEN ‘WU_E_PT_FILE_LOCATIONS_CHANGED Operation failed due to a changed file location; refresh internal state and resend.’
WHEN ‘80244026’ THEN ‘WU_E_PT_REGISTRATION_NOT_SUPPORTED Operation failed because Windows Update Agent does not support registration with a non-WSUS server.’
WHEN ‘80244027’ THEN ‘WU_E_PT_NO_AUTH_PLUGINS_REQUESTED The server returned an empty authentication information list.’
WHEN ‘80244028’ THEN ‘WU_E_PT_NO_AUTH_COOKIES_CREATED Windows Update Agent was unable to create any valid authentication cookies.’
WHEN ‘80244029’ THEN ‘WU_E_PT_INVALID_CONFIG_PROP A configuration property value was wrong.’
WHEN ‘8024402A’ THEN ‘WU_E_PT_CONFIG_PROP_MISSING A configuration property value was missing.’
WHEN ‘8024402B’ THEN ‘WU_E_PT_HTTP_STATUS_NOT_MAPPED The HTTP request could not be completed and the reason did not correspond to any of the WU_E_PT_HTTP_* error codes.’
WHEN ‘8024402C’ THEN ‘WU_E_PT_WINHTTP_NAME_NOT_RESOLVED Same as ERROR_WINHTTP_NAME_NOT_RESOLVED – the proxy server or target server name cannot be resolved.’
WHEN ‘8024502D’ THEN ‘WU_E_PT_SAME_REDIR_ID Windows Update Agent failed to download a redirector cabinet file with a new redirectorId value from the server during the recovery.’
WHEN ‘8024502E’ THEN ‘WU_E_PT_NO_MANAGED_RECOVER A redirector recovery action did not complete because the server is managed.’
WHEN ‘8024402F’ THEN ‘WU_E_PT_ECP_SUCCEEDED_WITH_ERRORS External cab file processing completed with some errors.’
WHEN ‘80244030’ THEN ‘WU_E_PT_ECP_INIT_FAILED The external cab processor initialization did not complete.’
WHEN ‘80244031’ THEN ‘WU_E_PT_ECP_INVALID_FILE_FORMAT The format of a metadata file was invalid.’
WHEN ‘80244032’ THEN ‘WU_E_PT_ECP_INVALID_METADATA External cab processor found invalid metadata.’
WHEN ‘80244033’ THEN ‘WU_E_PT_ECP_FAILURE_TO_EXTRACT_DIGEST The file digest could not be extracted from an external cab file.’
WHEN ‘80244034’ THEN ‘WU_E_PT_ECP_FAILURE_TO_DECOMPRESS_CAB_FILE An external cab file could not be decompressed.’
WHEN ‘80244035’ THEN ‘WU_E_PT_ECP_FILE_LOCATION_ERROR External cab processor was unable to get file locations.’
WHEN ‘80244FFF’ THEN ‘WU_E_PT_UNEXPECTED A communication error not covered by another WU_E_PT_* error code.’
WHEN ‘80242000’ THEN ‘WU_E_UH_REMOTEUNAVAILABLE A request for a remote update handler could not be completed because no remote process is available.’
WHEN ‘80242001’ THEN ‘WU_E_UH_LOCALONLY A request for a remote update handler could not be completed because the handler is local only.’
WHEN ‘80242002’ THEN ‘WU_E_UH_UNKNOWNHANDLER A request for an update handler could not be completed because the handler could not be recognized.’
WHEN ‘80242003’ THEN ‘WU_E_UH_REMOTEALREADYACTIVE A remote update handler could not be created because one already exists.’
WHEN ‘80242004’ THEN ‘WU_E_UH_DOESNOTSUPPORTACTION A request for the handler to install (uninstall) an update could not be completed because the update does not support install (uninstall).’
WHEN ‘80242005’ THEN ‘WU_E_UH_WRONGHANDLER An operation did not complete because the wrong handler was specified.’
WHEN ‘80242006’ THEN ‘WU_E_UH_INVALIDMETADATA A handler operation could not be completed because the update contains invalid metadata.’
WHEN ‘80242007’ THEN ‘WU_E_UH_INSTALLERHUNG An operation could not be completed because the installer exceeded the time limit.’
WHEN ‘80242008’ THEN ‘WU_E_UH_OPERATIONCANCELLED An operation being done by the update handler was cancelled.’
WHEN ‘80242009’ THEN ‘WU_E_UH_BADHANDLERXML An operation could not be completed because the handler-specific metadata is invalid.’
WHEN ‘8024200A’ THEN ‘WU_E_UH_CANREQUIREINPUT A request to the handler to install an update could not be completed because the update requires user input.’
WHEN ‘8024200B’ THEN ‘WU_E_UH_INSTALLERFAILURE The installer failed to install (uninstall) one or more updates.’
WHEN ‘8024200C’ THEN ‘WU_E_UH_FALLBACKTOSELFCONTAINED The update handler should download self-contained content rather than delta-compressed content for the update.’
WHEN ‘8024200D’ THEN ‘WU_E_UH_NEEDANOTHERDOWNLOAD The update handler did not install the update because it needs to be downloaded again.’
WHEN ‘8024200E’ THEN ‘WU_E_UH_NOTIFYFAILURE The update handler failed to send notification of the status of the install (uninstall) operation.’
WHEN ‘8024200F’ THEN ‘WU_E_UH_INCONSISTENT_FILE_NAMES The file names contained in the update metadata and in the update package are inconsistent.’
WHEN ‘80242010’ THEN ‘WU_E_UH_FALLBACKERROR The update handler failed to fall back to the self-contained content.’
WHEN ‘80242011’ THEN ‘WU_E_UH_TOOMANYDOWNLOADREQUESTS The update handler has exceeded the maximum number of download requests.’
WHEN ‘80242012’ THEN ‘WU_E_UH_UNEXPECTEDCBSRESPONSE The update handler has received an unexpected response from CBS.’
WHEN ‘80242013’ THEN ‘WU_E_UH_BADCBSPACKAGEID The update metadata contains an invalid CBS package identifier.’
WHEN ‘80242014’ THEN ‘WU_E_UH_POSTREBOOTSTILLPENDING The post-reboot operation for the update is still in progress.’
WHEN ‘80242015’ THEN ‘WU_E_UH_POSTREBOOTRESULTUNKNOWN The result of the post-reboot operation for the update could not be determined.’
WHEN ‘80242016’ THEN ‘WU_E_UH_POSTREBOOTUNEXPECTEDSTATE The state of the update after its post-reboot operation has completed is unexpected.’
WHEN ‘80242017’ THEN ‘WU_E_UH_NEW_SERVICING_STACK_REQUIRED The OS servicing stack must be updated before this update is downloaded or installed.’
WHEN ‘80242FFF’ THEN ‘WU_E_UH_UNEXPECTED An update handler error not covered by another WU_E_UH_* code.’
WHEN ‘C80003F3’ THEN ‘hrOutOfMemory: The computer is out of memory. Generally reported when WSUS try to initialize its datastore.’
WHEN ‘C800042D’ THEN ‘hrVersionStoreOutOfMemory: Generally reported when the WUA is unable to update %WINDIR%\SoftwareDistribution folder.’
WHEN ‘80040692’ THEN ‘ConfigMgr Custom Error: Group Policy conflict. Check domain GPOs applying to this machine.’
WHEN ‘80040693’ THEN ‘ConfigMgr Custom Error: WUA version is lower than expected. Upgrade WUA.’
WHEN ‘80040708’ THEN ‘ConfigMgr Custom Error: Software Updates Install not required.’
WHEN ‘80040709’ THEN ‘ConfigMgr Custom Error: Failed to resume the monitoring of the process.’
WHEN ‘8004070A’ THEN ‘ConfigMgr Custom Error: Invalid command line.’
WHEN ‘8004070B’ THEN ‘ConfigMgr Custom Error: Failed to create process.’
WHEN ‘8004070C’ THEN ‘ConfigMgr Custom Error: Software update execution timeout.’
WHEN ‘8004070D’ THEN ‘ConfigMgr Custom Error: Software update failed when attempted.’
WHEN ‘8004070E’ THEN ‘ConfigMgr Custom Error: Empty command line specified.’
WHEN ‘8004070F’ THEN ‘ConfigMgr Custom Error: Invalid updates installer path.’
WHEN ‘80040710’ THEN ‘ConfigMgr Custom Error: Failed to compare process creation time.’
WHEN ‘80040711’ THEN ‘ConfigMgr Custom Error: Software updates deployment not active yet; for example, start time is in the future.’
WHEN ‘80040712’ THEN ‘ConfigMgr Custom Error: A system restart is required to complete the installation.’
WHEN ‘80040713’ THEN ‘ConfigMgr Custom Error: Software updates detection results not received yet.’
WHEN ‘80040714’ THEN ‘ConfigMgr Custom Error: User based install not allowed as system restart is pending.’
WHEN ‘80040715’ THEN ‘ConfigMgr Custom Error: No applicable updates specified in user install request.’
WHEN ‘80040154’ THEN ‘ConfigMgr Custom Error: Class not registered. Try repairing the ConfigMgr client.’
WHEN ‘80040668’ THEN ‘ConfigMgr Custom Error: Software update still detected as actionable after apply.’
WHEN ‘80040600’ THEN ‘ConfigMgr Custom Error: Scan Tool Policy not found.’
WHEN ‘80040602’ THEN ‘ConfigMgr Custom Error: Out of cache space.’
WHEN ‘80040603’ THEN ‘ConfigMgr Custom Error: The ScanTool Policy has been removed, this prevents completion of Scan Operations. (E_SCANTOOL_NOTFOUND_INJOBQUEUE)’
WHEN ‘80040604’ THEN ‘ConfigMgr Custom Error: Scan Tool has been Removed. (E_FAIL_SCAN_TOOL_REMOVED)’
WHEN ‘80040605’ THEN ‘ConfigMgr Custom Error: Scan Tool Policy not found. (E_FAIL_OFFLINE_SCAN_HISTORY_NOT_FOUND)’
WHEN ‘80040608’ THEN ‘ConfigMgr Custom Error: Out of cache space.’
WHEN ‘80008201’ THEN ‘ConfigMgr Custom Error: Out of cache space.’
WHEN ‘80008202’ THEN ‘ConfigMgr Custom Error: Cache size is smaller than requested content”s size.’
WHEN ‘80004005’ THEN ‘ConfigMgr Custom Error: Access denied. Possible corrupt local policy.’
WHEN ‘80040694’ THEN ‘ConfigMgr Custom Error: Failed to add update source for WUAgent.’
WHEN ‘8007000E’ THEN ‘Win32 Error: Not enough storage is available to complete this operation.’
WHEN ‘800705B4’ THEN ‘Win32 Error: The operation returned because the timeout period expired.’
WHEN ‘80070050’ THEN ‘Win32 Error: The file already exists.’
WHEN ‘80070005’ THEN ‘Win32 Error: Access Denied.’
WHEN ‘8007041D’ THEN ‘Win32 Error: The service did not respond to the start or control request in a timely fashion.’
WHEN ‘80004002’ THEN ‘Win32 Error: No such interface supported.’
WHEN ‘80072EE2’ THEN ‘ERROR_INTERNET_TIMEOUT: The request has timed out. Server too busy. Try again later.’
WHEN ‘80072EEC’ THEN ‘ERROR_INTERNET_SHUTDOWN: WinINet support is being shut down or unloaded.’
WHEN ‘80072EFE’ THEN ‘ERROR_INTERNET_TIMEOUT: Internet connection interruption.’
WHEN ‘80072F76’ THEN ‘ERROR_INTERNET_TIMEOUT: Internet connection interruption.’
WHEN ‘80072F84’ THEN ‘ERROR_INTERNET_SERVER_UNREACHABLE: The Web site or server indicated is unreachable.’
WHEN ‘80072F7D’ THEN ‘ERROR_INTERNET_SECURITY_CHANNEL_ERROR: The application experienced an internal error loading the SSL libraries.’
WHEN ‘80072F89’ THEN ‘ERROR_INTERNET_SEC_INVALID_CERT: SSL certificate is invalid.’
WHEN ‘80072F8A’ THEN ‘ERROR_INTERNET_SEC_CERT_REVOKED: SSL certificate was revoked.’
WHEN ‘80072F19’ THEN ‘ERROR_INTERNET_SEC_CERT_REV_FAILED: Certificate revocation check failed.’
WHEN ‘80072F17’ THEN ‘ERROR_INTERNET_SEC_CERT_ERRORS: The SSL certificate contains errors.’
WHEN ‘80072F05’ THEN ‘ERROR_INTERNET_SEC_CERT_DATE_INVALID: SSL certificate date that was received from the server is bad. The certificate is expired.’
WHEN ‘80072F06’ THEN ‘ERROR_INTERNET_SEC_CERT_CN_INVALID: SSL certificate common name (host name field) is incorrect—for example, if you entered www.server.com and the common name on the certificate says www.different.com.’
ELSE ‘Unknown Error’
END,
NumberOfComputers = count(*),
UpdateSourceID = @UpdateSourceID,
CollectionID = @CollID
from fn_rbac_SoftwareUpdateSource(@UserSIDs) sus
join fn_rbac_UpdateScanStatus(@UserSIDs) uss
on sus.UpdateSource_ID=uss.UpdateSource_ID
and uss.LastScanState in (5,6)
and uss.LastStatusMessageID is not null
join fn_rbac_ClientCollectionMembers(@UserSIDs) ccm on ccm.ResourceID=uss.ResourceID and ccm.CollectionID=@CollID
left join fn_rbac_AdvertisementStatusInformation(@UserSIDs) asi on uss.LastStatusMessageID&0x0000FFFF=asi.MessageID
left join fn_rbac_AdvertisementStatusInformation(@UserSIDs) statusinfo on statusinfo.MessageID=nullif(uss.LastStatusMessageID&0x0000FFFF, 0)
where sus.UpdateSource_UniqueID=@UpdateSourceID and sus.IsExpired=0
group by uss.LastStatusMessageID&0x0000FFFF, isnull(uss.LastErrorCode,0), asi.MessageName
order by 6 desc, 1, 3

If you would like to run this from your SQL Server Management Studio and need values for your variables you can use the following at the top of your query.

declare @UpdateSourceID varchar (50); set @UpdateSourceID = ‘YOUR_UPDATESOURCEID’
declare @CollID varchar (8); set @CollID = ‘SMS00001’
Declare @UserSIDs As Varchar(25); Set @UserSIDs = ‘Disabled’