Get-SCSMObject not returning computers

Sep 13, 2013 at 5:19 AM
I'm stumped. Hopefully someone can tell me what I'm doing wrong. I'm just trying to get a list of computers from SCSM. I'm querying classes and names that I know exist (I can see them from the SCSM console), and I'm getting no results back at all.

This is what I'm running:

$Class = Get-SCSMClass -Name$
Get-SCSMObject -Class $Class -filter "PrincipalName -like servername"

This returns nothing at all, but again, I know the server name actually exists in SCSM.

I can also just do a Get-SCSMObject -Class $Class and get no results, either. I would think that this should return all items of the server class.

Thanks in advance for your help. This is driving me insane!
Sep 15, 2013 at 11:43 AM
Maybe you're looking at the wrong class. Have you tried Microsoft.Windows.Computer$ instead?

Try to go backwards instead like this:

$Class = Get-SCSMClass -Name system.entity #most parent class

$obj = Get-SCSMObject -Class $Class -Filter "Name -like servername" #make sure to have filter here, or you're gonna wait all night : )


This will get you the class of the object.