1

I'm currently programming some right-click tools in PowerShell for the SCCM 2012. I'd like to program a tool, which displays the Status Message Queries of the right-clicked device.

I'd like to have a smiliar view as the SCCM -> Monitoring -> Status Message Queries -> All Status Messages from a Specific System

So far I have this WQL query:

select SMS_StatusMessage.*, SMS_StatMsgInsStrings.*, SMS_StatMsgAttributes.* 
from  SMS_StatusMessage left join SMS_StatMsgInsStrings on SMS_StatMsgInsStrings.RecordID = SMS_StatusMessage.RecordID
left join SMS_StatMsgAttributes on SMS_StatMsgAttributes.RecordID = SMS_StatusMessage.RecordID 
where SMS_StatusMessage.MachineName = "MyMachineName"

but this doesn't give the description as I see in the "All Status Messages from a Specific System". (see screenshot).

Does anyone know how I get the description of a Status Message?

Best regards faebuk

faebuk
  • 51
  • 2
  • 8

2 Answers2

1

Just snipped this from something I was testing with.. probably will get you pointed in the correct direction..

SELECT b.Component, b.MachineName, b.MessageType, b.MessageID, 
       c.insstrvalue,
       d.attributevalue, d.attributeTime 
FROM SMS_StatusMessage b 
    JOIN SMS_StatMsgInsStrings c ON b.RecordID = c.RecordID
    JOIN SMS_StatMsgAttributes d ON c.RecordID = d.RecordID
WHERE b.Component = "Task Sequence Manager"
    AND   d.AttributeID = 401 
    AND   b.MachineName = "MyMachineName"
    AND   b.MessageID = 11171                      
    AND   d.AttributeValue = "DeploymentID"

Ultimately this is from the SDK.

Pieter Goosen
  • 9,768
  • 5
  • 35
  • 55
David Wallis
  • 185
  • 11
  • The (translated) format string associated with a particular message ID is not in SMS_StatusMessage, SMS_StatMsgInsStrings, or SMS_StatMsgAttributes. Those just contain the useful data (e.g. AdvertisementID's, etc.) for the message. The format string is obtained some other way than the WQL query. See [SMS Status Messages - ASP to show all MessageIDs and their meanings](http://myitforum.com/cs2/blogs/jnelson/archive/2008/05/21/117428.aspx) for some clues about acquiring the format strings. – mojo Nov 07 '14 at 12:58
  • 1
    FWIW, the translated messages appear to be in a DLL in the SCCM console install directory. For 2012/US-English, it's `\AdminUI\bin\i386\00000409\srvmsgs.dll`. I think the 2007 console saves them in a similar location, `AdminConsole\bin\...\srvmsgs.dll`. – mojo Nov 07 '14 at 18:09
0

just looking at my SO profile and saw this thread I had previously replied to.. I have recently needed to do the same and blogged it!

SELECT
 CASE [Severity] 
  WHEN '1073741824' THEN 'Informational' 
  WHEN '-1073741824' THEN 'Error' 
  WHEN '-2147483648' THEN 'Warning' 
 END AS Severity
  ,[SiteCode]
  ,[Time]
  ,[MachineName]
  ,[Component]
  ,[MessageID],
 CASE [MessageID] 
  WHEN '11124' THEN ('The task sequence execution engine started the group (' + [InsStrValue3] + ').')
  WHEN '11127' THEN ('The task sequence execution engine successfully completed the group (' + [InsStrValue3] + ').') 
  WHEN '11128' THEN ('The task sequence execution engine skipped the disabled action (' + [InsStrValue2] + ') in the group (' + [InsStrValue3] + ').') 
  WHEN '11130' THEN ('The task sequence execution engine skipped the action (' + [InsStrValue2] + ') in the group (' + [InsStrValue3] + ').')
  WHEN '11134' THEN ('The task sequence execution engine successfully completed the action (' + [InsStrValue2] + ') in the group (' + [InsStrValue3] + ') with exit code ' + [InsStrValue4] + ' Action output: ' + (COALESCE([InsStrValue5], '') + '' + COALESCE([InsStrValue6], '') + '' + COALESCE([InsStrValue7],'')+ COALESCE([InsStrValue8],'')+ COALESCE([InsStrValue9],'')+ COALESCE([InsStrValue10],''))) 
  WHEN '11135' THEN ('The task sequence execution engine failed execuiting the action (' + [InsStrValue2] + ') in the group (' + [InsStrValue3] + ') with exit code ' + [InsStrValue4] + ' Action output: ' + (COALESCE([InsStrValue5], '') + '' + COALESCE([InsStrValue6], '') + '' + COALESCE([InsStrValue7],'')+ COALESCE([InsStrValue8],'')+ COALESCE([InsStrValue9],'')+ COALESCE([InsStrValue10],'')))  
  WHEN '11138' THEN ('The task sequence execution engine ignored execution failure of the action (' + [InsStrValue2] + ') in the group (' + [InsStrValue3] + ').')  
  WHEN '11140' THEN ('The task sequence execution engine started execution of a task sequence.')  
  WHEN '11142' THEN ('The task sequence execution engine performed a system reboot initiated by the action (' + [InsStrValue2] + ') in the group (' + [InsStrValue3] + ').')  
  WHEN '11144' THEN ('The task sequence execution engine from a non-client started execution of a task sequence.')
 END AS Description 
FROM [CM_SiteCode].[dbo].[vStatusMessagesWithStrings] (NOLOCK) 
WHERE MachineName = 'MyServerNameHere'
 AND Component in ('Task Sequence Engine','Task Sequence Manager','Task Sequence Action')
 AND Time BETWEEN '2015-04-02 08:30' AND GETDATE() 
ORDER BY Time DESC

see here http://blog.wallis2000.co.uk/2015/04/status-messages-from-sccm-task.html

David Wallis
  • 185
  • 11