Hi All!
I am trying to use the Invoke Power Shell activity but I keep receiving an error message. I have tested my script in PowerShell and it is working without an issue (the script is below), is it due to the proper modules not being installed?
Script: “$name = get-aduser -identity $id | select-object -expandproperty name”
18.4.1+Branch.master.Sha.bc66386dd8e2160b6d35f31d5ce934a5aa4cf4bd
Source: Invoke Power Shell (Throw)
Message: The term ‘$name = get-aduser -identity $id | select-object -expandproperty name’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Exception Type: System.Management.Automation.CommandNotFoundException
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Management.Automation.CommandNotFoundException: The term ‘$name = get-aduser -identity $id | select-object -expandproperty name’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
- at System.Activities.Statements.Throw.Execute(CodeActivityContext context)*
- at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)*
- at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)*
- at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)*