SCCM WMI question

Welcome Forums General PowerShell Q&A SCCM WMI question

This topic contains 5 replies, has 4 voices, and was last updated by

 
Participant
2 years, 3 months ago.

  • Author
    Posts
  • #57674

    Participant
    Points: 0
    Rank: Member

    I'm trying to query SCCM , filtering by computer, using the following script:

    Get-WmiObject -ComputerName SOMESERVER -Namespace "root\sms\site_SOMESITE" -Class "SMS_CollectionMember_a" -Filter "ResourceID='SOMEDEVICEID'"

    It isn't outputting anything though I've confirmed via the SCCM console that the Device ID is correct and the machine does belong to several collections. I would appreciate some help.

  • #57727

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Have you tried this with the -Filter removed?

    • #57740

      Participant
      Points: 0
      Rank: Member

      Don, I did try it. There are over 2,000 machines in SCCM. Based on the time the query ran I think it was successful, however, again it didn't output any information.

      Olaf, thank you for the suggestion. I looked into using Get-CMDevice but felt that the WMI Objects were better suited to my needs. I may have to reinvestigate.

  • #57737

    Participant
    Points: 643
    Helping Hand
    Rank: Major Contributor

    SCCM comes with a bunch of cmdlets. If you like to make your life easier you should use those.

  • #57776

    Participant
    Points: 0
    Rank: Member

    For investigative purposes only you could try

    Get-WmiObject -ComputerName SOMESERVER -Namespace "root\sms\site_SOMESITE" -Class "SMS_CollectionMember_a" | Where ResourceID -eq SOMEDEVICEID

    ResourceID should be a 32 bit unsigned integer

    Alternatively try

    Get-WmiObject -ComputerName SOMESERVER -Namespace "root\sms\site_SOMESITE" -Class "SMS_CollectionMember_a" | sort ResourceID
    | select Name, ResourceID

    The SMS_CollectionMember_a class is documented here https://msdn.microsoft.com/en-us/library/cc145603.aspx

  • #57779

    Participant
    Points: 0
    Rank: Member

    Thanks Richard. That query works and will suffice for my immediate needs.

The topic ‘SCCM WMI question’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort