【问题标题】:PowerShell SCCM display Status Message QueriesPowerShell SCCM 显示状态消息查询
【发布时间】:2014-10-01 09:46:07
【问题描述】:

我目前正在 PowerShell 中为 SCCM 2012 编写一些右键单击工具。 我想编写一个工具,它显示右键单击设备的状态消息查询。

我希望有一个与 SCCM 类似的视图 -> 监控 -> 状态消息查询 -> 来自特定系统的所有状态消息

到目前为止,我有这个 WQL 查询:

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"

但这并没有给出我在“来自特定系统的所有状态消息”中看到的描述。 (见截图)。

有人知道我如何获得状态消息的描述吗?

最好的问候 飞步

【问题讨论】:

    标签: windows powershell sccm wql


    【解决方案1】:

    刚刚从我正在测试的东西中剪下这个..可能会让你指向正确的方向..

    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"
    

    这最终来自 SDK。

    【讨论】:

    • 与特定消息 ID 关联的(已翻译)格式字符串不在 SMS_StatusMessage、SMS_StatMsgInsStrings 或 SMS_StatMsgAttributes 中。那些只包含消息的有用数据(例如广告 ID 等)。格式字符串是通过 WQL 查询以外的其他方式获得的。有关获取格式字符串的一些线索,请参阅SMS Status Messages - ASP to show all MessageIDs and their meanings
    • FWIW,翻译后的消息似乎位于 SCCM 控制台安装目录中的 DLL 中。对于 2012/美国英语,它是 <installdir>\AdminUI\bin\i386\00000409\srvmsgs.dll。我认为 2007 控制台将它们保存在类似的位置,AdminConsole\bin\...\srvmsgs.dll
    【解决方案2】:

    刚刚查看了我的 SO 个人资料,看到了我之前回复过的这个帖子。我最近需要做同样的事情并写了博客!

    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
    

    看这里http://blog.wallis2000.co.uk/2015/04/status-messages-from-sccm-task.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-12
      • 1970-01-01
      • 2021-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-24
      • 2016-10-30
      相关资源
      最近更新 更多