Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 168455

Re: esxcli from vCO using PowerShell plugin

$
0
0

Hi Juan,

 

The PowerShellRemotePSObject is an object containing the output of a PS command.
For example when running [Get-EsxCli -VMHost esx-mgmt-a-11.vmware.com] the output (shown on screnshot1) is your PowerShellRemotePSObject.

// ----- output from Get-EsxCli -VMHost esx-mgmt-a-11.vmware.com

================================

EsxCli: esx-mgmt-a-11.vmware.com

 

   Elements:

   ---------

   device

   esxcli

   fcoe

   graphics

   hardware

   iscsi

   network

   sched

   software

   storage

   system

   vm

   vsan

 

// ----- end of output

 

For example you can parse it as JSON to verify successful execution or use it as an input (in PS words "Pipe it") for another ps command.

...

var psOutput_temp = PSOut.getAsJson();

if( psOutput_temp.search('success') {

...

 

Let me simplify your code and give you another example. If i put all the commands in your code in one single PS script (commands on one line separated by ; ) this would look something like this:

 

Add-PSSnapin VMware.VimAutomation.Core -ErrorAction  SilentlyContinue; Connect-VIServer <vCenterServerName> -user <vCenterAdmin> -Password <vCenterAdminPAssword> ; Get-EsxCli -VMHost <esxiHost>

 

Now use the [invoke a powershell script] wf to run this script. Th output is the same as above (shown on screenshot2). Again this is your PowerShellRemotePSObject which you can parse or pipe to another ps command.
Note that connecting to vCenter server might require CredSSP enabled on the PS host. For more info visit, Using CredSSP with the vCO PowerShell Plugin | Spas Kaloferov's Blog
If interested in more PS example WF's , visit http://kaloferov.com/blog/com-spaskaloferov-vco-vro-workflow-library-package/

 

BR,
Spas Kaloferov
www.kaloferov.com


Viewing all articles
Browse latest Browse all 168455

Trending Articles



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