Having trouble with this bit of code... the -filter is not working as I would expect.
$MAID is set from the authoring tool
Everything works up to the last line.
Nothing is returned, no error... no results.
But if I do this,
Get-SCSMObject -Class $CRClass | ?{$_.displayname -eq "CR7554: Are we able to hide these in the Navigation Pane?"}
I get the CR as expected. I can even do this,
Get-SCSMObject -Class $CRClass | ?{$_.displayname -eq "$CRdisplayname?"}
And it works as expected.
$MAID is set from the authoring tool
Everything works up to the last line.
Gets the MAobj
$MAobj = Get-SCSMObject -Class $MAClass -Filter "ID -eq $MAID"Filters out the All Activites Q, (no other Qs exist)
$ParentCR = Get-SCSMRelationshipObject -ByTarget $MAobj | ? {$_.sourceobject.tostring() -ne "All Activities Queue"}Gets the CR displayname from the source object in the relationship
[string]$CRdisplayname = $ParentCR.SourceObject.DisplayNameAttempts to pull the CR based on the above values.
$CRobj = Get-SCSMObject -Class $CRClass -Filter "Displayname -eq $CRdisplayname"Nothing is returned, no error... no results.
But if I do this,
Get-SCSMObject -Class $CRClass | ?{$_.displayname -eq "CR7554: Are we able to hide these in the Navigation Pane?"}
I get the CR as expected. I can even do this,
Get-SCSMObject -Class $CRClass | ?{$_.displayname -eq "$CRdisplayname?"}
And it works as expected.