Add RO to SO with powershell
I tried to do this but I get an error
Who know please help.
ERROR:
+ New-SCRelationshipInstance -RelationshipClass $relationship -Source $SO -Target ...
Best Answer
-
Justin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭@Roman_Nepomniashchii - You have to get the Service Offering as a projection and add the RO that way.
<div>$roClass = Get-SCSMClass -name system.requestoffering </div><div>$RO = Get-SCSMObject -Class $roClass -Filter "DisplayName -eq 'RO TITLE HERE'"</div><div> $rel = Get-SCSMRelationshipClass -name System.ServiceOfferingRelatesToRequestOffering </div><div> $soTP = Get-SCSMTypeProjection -Name System.ServiceOffering.Portal.ProjectionType</div><div> $so = Get-SCSMObjectProjection -Projection $soTP -Filter "title -eq 'SO TITLE HERE'"</div><div> $so.__base.add($ro, $rel.Target)</div><div> $so.__base.Commit()</div>
6
Answers