Home Powershell

Add RO to SO with powershell

Roman_NepomniashchiiRoman_Nepomniashchii Customer IT Monkey ✭
edited July 2018 in Powershell
Please help, who knows how to write a script that adds RO to SO?
I tried to do this but I get an error
Who know please help.
$SO = Get-SCSMObject -Class (Get-SCSMClass -Name System.serviceOffering)| Where ID -eq "1|Company.Configuration|1.0.0.0|Offering8b6b1a620ae040e1a708b4dfd30a8204|3|ServiceOffering"

$RO = Get-SCSMObject -Class (Get-SCSMClass -Name System.RequestOffering)| Where ID -eq "1|Company|1.0.0.0|Offeringfeb287de303b4dbb9c5a2bed0e60410f|3|RequestOffering" 

$relationship = Get-SCSMRelationship -name System.ServiceOfferingRelatesToRequestOffering

New-SCRelationshipInstance -RelationshipClass $relationship -Source $SO -Target $RO


ERROR:
New-SCRelationshipInstance : Cannot process extension elements as EnterpriseManagementObject. User EnterpriseManagementObjectProjection for all extension element CRUD operations.
At line:14 char:1
+ New-SCRelationshipInstance -RelationshipClass $relationship -Source $SO -Target  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (Microsoft.Syste...InstanceCommand:NewSCSMRelationshipInstanceCommand) [New-SCRelationshipInstance], InvalidOperationException
+ FullyQualifiedErrorId : ExecutionError,Microsoft.SystemCenter.Core.Commands.NewSCSMRelationshipInstanceCommand

Best Answer

Answers

  • Roman_NepomniashchiiRoman_Nepomniashchii Customer IT Monkey ✭
    Thank you very much, you very much helped!
  • Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭
    I'm glad to hear it!
Sign In or Register to comment.