HI,
I have used your code and tried to connect to the vsphere server.
But the pipeline.Invoke(); statement throws an exception saying
System.Management.Automation.CommandNotFoundException was unhandled
Message=The term 'Connect-VIServer -Server 172.17.21.51 -Protocol https -User vmuser -Password pass' 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.
Source=System.Management.Automation
WasThrownFromThrowStatement=false
CommandName=Connect-VIServer -Server 172.17.21.51 -Protocol https -User vmuser -Password pass
StackTrace:
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.Runspaces.Command.CreateCommandProcessor(ExecutionContext executionContext, CommandFactory commandFactory, Boolean addToHistory)
at System.Management.Automation.Runspaces.LocalPipeline.CreatePipelineProcessor()
at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
InnerException:
Is there any prerequisite to run these powercli commands? Please help me to resolve this error.