When I am running "iisreset  /status" script in powershell command it gives me an error

geethushanthosh
Kilo Contributor

Error:

The term 'iisreset /status' 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.Stack Trace: at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandOrigin commandOrigin)at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)at System.Management.Automation.CommandFactory._CreateCommand(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)at System.Management.Automation.ExecutionContext.CreateCommand(String command)at System.Management.Automation.CommandNode.CreateCommandProcessor(Int32& index, ExecutionContext context)at System.Management.Automation.CommandNode.AddToPipeline(PipelineProcessor pipeline, ExecutionContext context)at System.Management.Automation.PipelineNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)

1 ACCEPTED SOLUTION

try using this:



Invoke-Command -ComputerName ${workflow.scratchpad.hostname} -ScriptBlock {iisreset /status}


View solution in original post

7 REPLIES 7

Are you sure IIS is installed on that host?



Try the command "hostname" instead and see what it says. I'm wondering if the command is executing on your MID Server instead of the target host.



I tried the iisreset /status command on a machine w/o IIS feature installed and I got that error message:


iisreset : The term 'iisreset' is not recognized as the name of a cmdlet, function, script file, or operable program.



After I installed IIS it started working.


Thanks Johnny..



I have checked the command "hostname". Its giving my MID server as host. But I gave some other server in the Host name. It is taking my MID server as host default. Could you please help what is the problem here?


try using this:



Invoke-Command -ComputerName ${workflow.scratchpad.hostname} -ScriptBlock {iisreset /status}