How to get a report with Friendly scan errors

Hi Everyone,

I haven’t posted anything in ages so I thought I’d post something simple but hopefully useful.  We publish a list of all custom Configuration Manager 2007 errors in TechNet (it’s up here in case you haven’t seen it https://technet.microsoft.com/en-us/library/bb632794.aspx).  Now, while this list is really good when you’re trawling through Trace32 looking at logs, it’s not so useful when you’re trying to figure out why clients are failing.  We have a built-in report in Configuration Manager that provides this information, but again you get hex error codes (which are better than 32-bit decimal integers, but only a little).  So what I did was take the report and add a massive case statement with all the custom scan error messages. 

The new query for the scan errors can be found below.  You can clone the existing report, and put the below query in the new report.  Note that there may be some clipping on the blog page, but the underlying code is still there so when you highlight the text you’ll get the full line.

 select us.UpdateSourceName as UpdateSource, 
    us.UpdateSourceDescription as Description,
    us.UpdateSourceVersion as Version, 
    us.SourceSite as SourceSite
from v_SoftwareUpdateSource us with (NOLOCK) 
    where us.UpdateSource_UniqueID = @UpdateSourceID 

select 
    uss.LastStatusMessageID&0x0000FFFF as ErrorStatusID,
    asi.MessageName as Status,
    isnull(uss.LastErrorCode,0) as ErrorCode,
    dbo.fnConvertBinaryToHexString(convert(VARBINARY(8), isnull(uss.LastErrorCode,0))) as HexErrorCode,
    'Error Text' =
        CASE dbo.fnConvertBinaryToHexString(convert(VARBINARY(8), isnull(uss.LastErrorCode,0)))
            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 '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 declines 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 501 – 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 504 – 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 '8024400A' THEN 'WU_E_PT_SOAPCLIENT_PARSE: WUA client needs to be updated, message from server cannot be parsed.'
            WHEN '8024001E' THEN 'WU_E_SERVICE_STOP: Operation did not complete because the service or system was being shut down.'
            WHEN '8024400D' THEN 'WU_E_PT_SOAP_CLIENT: SOAP client found the message was malformed.'
            WHEN '80240032' THEN 'WU_E_INVALID_CRITERIA: The search criteria string sent to WUA from ConfigMgr was marked as invalid by WUA.'
            WHEN '80240012' THEN 'WU_E_DUPLICATE_ITEM: Failed to add file to the FileLocationList.'
            WHEN '80240032' THEN 'WUA Error: Failed to end search job. WUA failed searching for update with error.'
            WHEN '8024001D' THEN 'WUA Error: An update contains invalid metadata.'
            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 '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.'
            WHEN '80072EEC' THEN 'ERROR_INTERNET_SHUTDOWN: WinINet support is being shut down or unloaded.'
            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,
    count (*) as NumberOfComputers,
    @UpdateSourceID as UpdateSourceID,
    @CollID as CollectionID
from v_UpdateScanStatus uss with (NOLOCK) 
join v_ClientCollectionMembers ccm with (NOLOCK) on ccm.ResourceID=uss.ResourceID and ccm.CollectionID=@CollID
join v_SoftwareUpdateSource sus with (NOLOCK) on sus.UpdateSource_ID=uss.UpdateSource_ID
left join v_AdvertisementStatusInformation asi with (NOLOCK) on uss.LastStatusMessageID&0x0000FFFF=asi.MessageID
where sus.UpdateSource_UniqueID=@UpdateSourceID and uss.LastStatusMessageID <> 0
group by uss.LastStatusMessageID, isnull(uss.LastErrorCode,0), asi.MessageName
order by count(*) desc

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .

This post was contributed by Saud Al-Mishari, a Premier Field Engineer with Microsoft Premier Field Engineering, UK.