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

Configure WinRM with vRealize Orchestrator

$
0
0

Hello everyone,

 

I'm very, _very_, new to vRO and don't know javascript (bash, python, powershell yes, js.. no).  I have to say off the bat it looks very Puppet like with both it's level of sophistication and the concepts of workflows (being like Puppet modules) sans Ruby for Javascript.  Anyway.  The steps to get basic-auth http WinRM up are:

  1. c:\Windows\system32\winrm.cmd quickconfig -quiet
  2. c:\Windows\system32\winrm.cmd set winrm/config/service/auth @{Basic="true"}
  3. c:\Windows\system32\winrm.cmd set winrm/config/service @{AllowUnencrypted="true"}
  4. c:\Windows\system32\winrm.cmd set winrm/config/winrs @{MaxMemoryPerShellMB="2048"}

 

This link provided an excellent resource about WinRM, but it doesn't describe how to setup WinRM other than manually through a console:

http://kaloferov.com/blog/using-credssp-with-the-vco-powershell-plugin/

 

I can use the workflow "Run program in guest" 4x, once for each line, and that works.  But there HAS to be a better way.  So I tried to change the script to be a loop and modified the Input variable 'arguments' to be an Array/string and populated it with the 'quickconfig -quiet' and each of the 'set' parameters (programPath only has to be defined once).  Here's the code but it doesn't seem to work correctly:

Inputs:

vmUsername     string

vmPassword     string

vm                    VC:VirtualMachine

programPath     string

arguments          Array/string

 

Scriptable task - javascript

var host = vm.sdkConnection;

var guestOperationsManager = host.guestOperationsManager;

var guestAuth = new VcNamePasswordAuthentication();

guestAuth.username = vmUsername;

guestAuth.password = vmPassword;

 

var argsArrayLength = arguments.length

for (var i = 0; i < argsArrayLength; i++) {

  var guestProgramSpec = new VcGuestProgramSpec();

  guestProgramSpec.programPath = programPath;

  guestProgramSpec.arguments = arguments[i];

  var processManager = guestOperationsManager.processManager;

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

}

 

Here's an alternative where I run each step individually:

Inputs:

vmUsername   string

vmPassword    string

vm                    VC:VirtualMachine

programPath    string

argument1        string

argument2        string

argument3        string

argument4        string

 

Outputs:

result1     number

result2     number

result3     number

result4     number

 

Scriptable task - javascript

// Common to each run

var host = vm.sdkConnection;

var guestOperationsManager = host.guestOperationsManager;

var guestAuth = new VcNamePasswordAuthentication();

guestAuth.username = vmUsername;

guestAuth.password = vmPassword;

guestAuth.interactiveSession = interactiveSession;

 

// arugment1

var guestProgramSpec = new VcGuestProgramSpec();

guestProgramSpec.programPath = programPath;

guestProgramSpec.arguments = argument1;

//guestProgramSpec.workingDirectory = workingDirectory;

//guestProgramSpec.envVariables = environment;

var processManager = guestOperationsManager.processManager;

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

// --------------------------


// arugment2

var guestProgramSpec = new VcGuestProgramSpec();

guestProgramSpec.programPath = programPath;

guestProgramSpec.arguments = argument2;

//guestProgramSpec.workingDirectory = workingDirectory;

//guestProgramSpec.envVariables = environment;

var processManager = guestOperationsManager.processManager;

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

// --------------------------

 

// arugment3

var guestProgramSpec = new VcGuestProgramSpec();

guestProgramSpec.programPath = programPath;

guestProgramSpec.arguments = argument3;

//guestProgramSpec.workingDirectory = workingDirectory;

//guestProgramSpec.envVariables = environment;

var processManager = guestOperationsManager.processManager;

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

// --------------------------

 

// arugment4

var guestProgramSpec = new VcGuestProgramSpec();

guestProgramSpec.programPath = programPath;

guestProgramSpec.arguments = argument4;

//guestProgramSpec.workingDirectory = workingDirectory;

//guestProgramSpec.envVariables = environment;

var processManager = guestOperationsManager.processManager;

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

 

 

Anyway, suggestions would be greatly appreciated.

 

 

Thanks,

Jim


Viewing all articles
Browse latest Browse all 6251

Trending Articles



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