Stop-Process is not running from Invoke Powershell activity

activities

#1

Hi folks,

I am trying to run Stop-Process -Name “Name of Process” from the invoke PowerShell activity and I keep getting an error…

Main has thrown an exception

Source: Throw

Message: The term ‘cd C:\Windows\system32\
Stop-Process -Name “Name of Process”’ 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: CommandNotFoundException

System.Management.Automation.CommandNotFoundException: The term ‘cd C:\Windows\system32\
Stop-Process -Name “Name of Process”’ 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)

This doesn’t make much sense to me as if I run that command straight up in the PowerShell ISE it does exactly what I want.

The only thing I can think is that my argument type is incorrect…

What ought this be?


#2

Nevermind…I checked the “IsScript” checkbox and it worked without error and closed the process I wanted closed.


#3

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.