Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Powershell Workflow doesnt work when part of a larger workflow

$
0
0

I have a small workflow which runs a SCCM command on a powershell host using Guest Operations and passes a machinename as a string, as a parameter to a powershell script located on the powershell host which adds the machine to an SCCM Collection. This works fine.

 

Now when adding this workflow to a larger workflow and mapping the already available "machinename" In Parameter to this workflow, the command runs, but for some reason the machine is not added to the Collection in SCCM. I know the script is running as I have some logging and it is outputting to a file, but this does not cover any errors. I have added some log outputs to the workflow and verified that the strings passed to the guest are the same in both instances. I did have an issue with Powershell complaining that the variable wasn't of type System.string but I got round that one by using the string() function in JavaScript. is ther still something funny about this type?

 

The code is below but very lightly modified from the Standard "Run Command in Guest" workflow:

 

var host = vm.sdkConnection;

 

var guestOperationsManager = host.guestOperationsManager;

var guestAuth = new VcNamePasswordAuthentication();

guestAuth.username = vmUsername;

guestAuth.password = vmPassword;

guestAuth.interactiveSession = interactiveSession;

 

var guestProgramSpec = new VcGuestProgramSpec();

guestProgramSpec.programPath = programPath;

guestProgramSpec.arguments = arguments + ' "' + String(machineName) + '"';

guestProgramSpec.workingDirectory = workingDirectory;

guestProgramSpec.envVariables = environment;

 

System.log("Issuing command on Powershell Host: " + programPath + " " + arguments + ' "' + machineName + '"');

 

var processManager = guestOperationsManager.processManager;

result = processManager.startProgramInGuest(vm , guestAuth , guestProgramSpec);

System.log("Result of Command Issuance = " + result);


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>