Associate Manual Activity to Incident in SCSM

jansi rani krishnan 601 Reputation points

Hi Team,

I have created a MA through PowerShell. When i try to open the MA from the portal, It is throwing an error message.

"An error occurred while processing your request. The item you requested either do not exist or you do not have access to view it"

I have not yet associate the MA with any of the request type. I think this could be the reason for the above error.

Please share some information on How to associate MA with Incident via PowerShell code.

Your help is highly appreciated!


Service Manager
Service Manager
A family of System Center products for managing incidents and problems.
209 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,354 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 95,411 Reputation points MVP

    Hi @jansi rani krishnan ,

    here we go:

    # Create a Manual Activiy with different properties and AssignedTo User  
    Import-Module SMlets # Import SMLets module  
    $smdefaultserver = "SCSM1" # Define SCSM Management Server  
    # Define Manual Activity properties  
    $maTitle = "Test MA by PowerShell 1"  
    $maDescription = "Test Description"  
    $maPriority = "Medium"  
    $maArea = "Other"  
    $maStatus = "In Progress"  
    $maAssignedToUser = "ppan1234"  
    $relIncidentId = "IR2103"  
    # --------------------  
    $smdefaultserver = "SCSM1" # Define SCSM Management Server  
    $MAclass = Get-SCSMclass -name System.Workitem.Activity.ManualActivity$ # Get SCSM Manual Activity class object  
    $IRclass = Get-SCSMClass -Name System.workitem.Incident$ # Get SCSM Incident class object  
    $UserClass = Get-SCSMClass -name System.Domain.User$ # Get SCSM User class object  
    $relAssignedToUser = Get-SCSMRelationshipClass -Name System.WorkItemAssignedToUser # Get SCSM relationship AssignedTo User  
    $relWIcontainsActivity = Get-SCSMRelationshipClass -Name System.WorkItemContainsActivity # Get SCSM relationsip WI contains Activity  
    #  Get AssignedTo User    
    $maAssignedToUserObj = Get-SCSMObject -Class $UserClass -Filter "UserName -eq $maAssignedToUser"  
    # Get related Incident  
    $relIRobj = Get-SCSMObject -Class $IRclass -Filter "ID -eq $relIncidentId"  
    # Prepare Manual Activity properties  
    $properties = @{  
        Id          = "MA{0}"  
        Title       = $maTitle  
        Description = $maDescription  
        Priority    = $maPriority  
        Area        = $maArea  
        Status      = $maStatus  
    # Create Manual Activity object  
    $newMA = New-SCSMObject -Class $MAclass -PropertyHashtable $properties -PassThru -NoCommit  
    # Create relation IR - Manual Activity  
    if ($relIRobj -and $relIRobj) {  
        $newRelWIActivity = New-SCSMRelationshipObject -RelationShip $relWIcontainsActivity -Target $newMA -Source $relIRobj -NoCommit  
    # Set AssignedTo User  
    if ($maAssignedToUserObj -and $newMA) {  
        New-SCSMRelationshipObject -RelationShip $relAssignedToUser -Source $newMA -Target $maAssignedToUserObj -Bulk  


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Andreas Baumgarten

0 additional answers

Sort by: Most helpful