New-SCSMRelationshipObject issue

Dec 1, 2011 at 3:56 PM
Edited Dec 1, 2011 at 4:07 PM


I am trying to use Powershell to raise SCSM incidents. Each incident has a number of tasks that need to be performed and I wanted to raise these as related manual activities. Raising the incident and activity works fine but when trying to relate them it falls down. The code below is what I'm using:


$relationshipClass = Get-SCSMRelationshipClass System.WorkItemContainsActivity$
$incidentClass = Get-SCSMClass -name system.workitem.incident$ 
$activityClass = Get-SCSMClass -Name System.WorkItem.Activity.ManualActivity$

$myCall = Get-SCSMObject -Class $incidentClass -filter "ID -eq $myCallNo"

$newAct = New-SCSMObject -Class $activityClass -PropertyHashtable @{"ID"="MA{0}";"Title"=$task.Title;"Description"=$task.Desc; "Area"="Other"; "Priority"="Medium"; "Status"="In Progress"} -Passthru

New-SCSMRelationshipObject -Relationship $relationshipClass -Source $myCall -Target $newAct -Bulk -Verbose


And the result:


VERBOSE: Performing operation "New-SCSMRelationshipObject" on Target "Commit changes".
VERBOSE: Adding 2da498be-0485-b2b2-d520-6ebd1698e61b to IDD
VERBOSE: Performing operation "New-SCSMRelationshipObject" on Target "Commit Relationship Object".
New-SCSMRelationshipObject : A discovery data item was rejected because the item is already bound to another Membership relationship.
At line:1 char:27
+ New-SCSMRelationshipObject <<<<  -Relationship $relationshipClass -Source $myCall -Target $myAct -Bulk -Verbose
    + CategoryInfo          : NotSpecified: (:) [New-SCSMRelationshipObject], DiscoveryDataLifetimeDependencyException
    + FullyQualifiedErrorId : Microsoft.EnterpriseManagement.Common.DiscoveryDataLifetimeDependencyException,SMLets.NewSCSMRelationshipObject


If I try to create the relationship object with -NoCommit instead of Bulk the object gets created but I am unable to then commit it. The activity never has any related objects but the incident has one of class System.WorkItem.BillableTime. 

If the incident and activity are created in the SM console the objects look the same as the ones I am creating here, but there is also the require relationship object.

Has anyone had any success doing this with Powershell?

Dec 5, 2011 at 10:56 AM

Hi, I´m seeing the exact same issue. The workaround right now is to follow what this page says:, but not sure if that is best practice or recommended...


Hopefully someone has a better answer...

Dec 10, 2012 at 12:43 PM
Edited Dec 10, 2012 at 1:30 PM