Written
May 26, 2017
We have implemented this solution in our environment. We seem to be having an issue where the execute program activity 'Get Collection ID' sticks in a running state and doesn't proceed to the 'Tweak output' activity.
Its set in the command execution mode and the computer details is the scsm primary management server.
Command is as follows:
cmd /c | C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -nolog -outputformat "Text" -c "$CollID=@();import-module smlets;$class= Get-SCSMClass -Name System.WorkItem.ChangeRequest |where {$_.Displayname -eq 'Change Request'};$cr=get-scsmobject -class $class |where {$_.ID -eq '{CRID from "Initalize Data"'};$rclass= get-scsmrelationshipclass -name System.WorkItemAboutConfigItem;$objects=get-scsmrelationshipobject -bysource $cr |where {$_.RelationshipID -eq $rclass.id};foreach ($object in $objects){$i=0;$var=0;$values=$object.targetobject.values;foreach ($value in $values){if ($value.Type |Where {$_.name -eq 'CollectionID'}){$var=$i;}$i++;}$CollID+=$object.Targetobject.values.value[$var]}$CollID"
The CRID seems to pass through fine from what I can see. Does there need any config for the working folder or anything else?
Thanks