Activity ID Parameter not being passed to Powershell activity

Hello I have a custom workflow in which I want to pass the ID of a Manual Activity to my Powershell Script. i.e MA1234

I have set the Variable name as $MA_ID

It is not passing the ID rather it is passing.As a test I did $MA_ID | Out-File C:\myfile.txt

it creates the file and outputs:

 MPElement[Name="System_WorkItem_Library!System.WorkItem"]/Id$' and @State='Post']$


December 18th, 2013 6:19pm

I got around Mapping the ID. Now I am having issues with the Powershell version. 

Do powershell activities in the authoring console use Powershell 2.0 by default? can we change that? I did $PSVersionTable and got this for 


Name                           Value                                           
----                           -----                                           
CLRVersion                     2.0.50727.5472                                  
BuildVersion                   6.1.7601.17514                                  
PSVersion                      2.0                                             
WSManStackVersion              2.0                                             
PSCompatibleVersions           {1.0, 2.0}                                      
SerializationVersion           1.1.0.1                                         
PSRemotingProtocolVersion      2.1                                             

Free Windows Admin Tool Kit Click here and download it now
December 20th, 2013 7:29pm

Hey Jaime,

Would you mind sharing how you got around mapping the ID? been having the same issue in some WFs. other WFs in the same MP are working just fine and I cannot see any difference.

Best regards

April 2nd, 2015 6:59am

I can't remember exactly what I did. I'm reviewing the workflow and it looks the same as in the picture on this thread.

It may have simply been that I converted the ID to a string. So I set the $MA_ID variable to itself but as a string, like this

$ma_id=$ma_ID.ToString()

Then I could use $MA_ID in my script and it would be the MA GUID. You can get the Manual Activity as an object this way $MA= Get-SCSMObject -Id $ma_ID

Let me know if that works for you!

Free Windows Admin Tool Kit Click here and download it now
April 2nd, 2015 2:27pm

I found the problem yesterday. It seems that sometimes the authoring tool ignores the variable and doesn't auto generate the *.cs file properly. The way to work around it is to expand the script area in the PowerShell activity properties screen, there is going to be a little button that is partially show on top the script area. When you click that button it will allow you to choose the variable you want to insert into the script.

Apparently this fixed my problem. Some of the scripts however did not need this done. Other have simple worked by deleting the whole workflow activity and re-creating it.Stupid bug but keep at it and it will resolve itself.

April 3rd, 2015 9:14am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics