Home General Discussion
Options

getting relationships of config items

Mehwish_ShahidMehwish_Shahid Customer IT Monkey ✭

Hi,

I need to call the class properties and relationships of config items (Hardware Assets). I get the properties all right through the GetProjectionByCriteria API but it only returns me one relationship for some reason, if any at all. What could be the reason and how do I get all of the relationships of a HW asset? 

Best Answer

Answers

  • Options
    Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    That is because the projection you are specifying only has one relationship.  If you give it a different type projection with more relationships, you will get those too.

    Using SMLets in PowerShell, you can do the following to see all the available type projections for that class:

    Get-ScsmTypeProjection -ComputerName [[Your Server Name]] -Name HardwareAsset
    Obviously, remove the brackets when you type your SCSM server name above.  Note that the "Name" parameter finds matching strings, rather than an exact match.  This is perfect for your situation, but you can type the exact projection name (or use the -Id param) with a dollar sign ($) at the end if you want an exact match some other time.

    You will get a list of type projections (the name is the ProjectionType property), each showing a list of the different relationships that they include.

    If by some chance you do not see one that contains all the relationships you need, you can always make your own.  There are several older posts in this forum that delve into that, plus lots to be found by searching Google, but there are a few of us around here that could probably answer specifics if needed too. 
Sign In or Register to comment.