I'm trying to get a couple of workflows going in vRO to prove it as a concept. and I'm struggling.
I have a post-deployment powershell script which applies tags in various categories to a new VM and a couple of other things. The script itself works if I run it on the powershell host I've configured, and I can run a very simple powershell script
The script I am using is below
var output;
var session;
try {
session = host_1.openSession();
var arguments = name + " " + WSUS + " \"" + Avamar + "\" \"" + Classification + "\" " ;
var script1 = '& "' + script + '" ' + arguments;
output = System.getModule("com.vmware.library.powershell").invokeScript(host_1,script1,session.getSessionId()) ;
var psOutput = getHostOutput();
System.log("Output:"+psOutput);
}
finally {
if (session){
host_1.closeSession(session.getSessionId());
}
}
And the error I get is below.
PowerShellInvocationError: Errors found while executing script System.Management.Automation.CommandNotFoundException: The term 'Instance' 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.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args) at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0() at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action) at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args) at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args) at Microsoft.PowerShell.Commands.InvokeExpressionCommand.ProcessRecord() at System.Management.Automation.CommandProcessor.ProcessRecord() (Dynamic Script Module name : invokeScript#15)
I'd be grateful for any pointers and help
Gary