How to combine 2 commands in a pipeline and use select object that picks output from each of the Command RRS feed

  • Question

  • Hi,

    I'm a SCSM Administrator.

    Command 1: This gives me details on an Incident Request using SMLets module.

    Get-SCSMObject -Class $IRClass -Filter "id -eq IR245332" | select id,Classification

    Result of command 1:

    Id       Classification
    --       --------------
    IR245332 AntiVirus Security

    Command 2: This one gives me the SLA associated with this Incident Request by pipelining with the previous one 

    Get-SCSMObject -Class $IRClass -Filter "id -eq IR245332" | Get-SCSMRelatedObject -Relationship $SLARel | select TargetEndDate,DisplayName

    Result of Command 1 pipelined with Command 2:

    TargetEndDate       DisplayName
    -------------       -----------
    15-03-2018 19:00:00 Incident Response P3

    20-03-2018 16:00:00 Incident Resolution time SLO priority 3

    Now that I need the output of command 1: (id, classification) along with the output after pipeline (TargetEndDate,DisplayName)

    Example output that is desired:

    Id Classification TargetEndDate DisplayName             
    -- -------------- --------------- --------------
    IR245332 AntiVirus Security 15-03-2018 19:00:00     Incident Response P3
    IR245332 AntiVirus Security 20-03-2018 16:00:00     Incident Resolution time SLO Priority 3

    How to achieve this? Any help please

    I tried something like this:

    Get-SCSMObject -Class $IRClass -Filter "id -eq IR245332" | Select Id,Classification | Get-SCSMRelatedObject -Relationship $SLARel | select TargetEndDate,DisplayName

    Get-SCSMObject -Class $IRClass -Filter "id -eq IR245332" | Get-SCSMRelatedObject -Relationship $SLARel | select id,Classification,TargetEndDate,DisplayName

    Thursday, April 19, 2018 11:52 AM


  • .... and creating a custom object would not work?
    $SCSMObject = Get-SCSMObject -Class $IRClass -Filter "id -eq IR245332" | select id,Classification
    $RelatedObject = Get-SCSMObject -Class $IRClass -Filter "id -eq IR245332" | Get-SCSMRelatedObject -Relationship $SLARel | select TargetEndDate,DisplayName
        ID             = $
        Classification = $SCSMObject.Classification
        TargetEndDate  = $RelatedObject.TargetEndDate
        DisplayName    = $RelatedObject.DisplayName

    Best regards,


    Thursday, April 19, 2018 12:04 PM