Samstag, 15. Juni 2013

vCenter Orchestrator Code Snippet: get Hot Plug Information (CPU/Memory)

Hey,
last week I wanted to get hot plug information from some virtual machines to include it into a powershell script.
So first thing I did is to create a vCO workflow to get such information like CPU and Memory settings.

Input parameters are only the virtual machine name as a string parameter, because it is delivered by a powershell script.

Input:
vmName (string)

Output:
vmName(string)
CPU(boolean)
Memory(boolean)

Script:
var VMs = VcPlugin.getAllVirtualMachines();

for(i in VMs)
{
if(VMs[i].name == vmName)
{
System.log(VMs[i].name + ' Hot CPU: ' + VMs[i].config.cpuHotAddEnabled);
System.log(VMs[i].name + 'Hot MEM: ' + VMs[i].config.memoryHotAddEnabled);
vmName = VMs[i].name;
CPU = VMs[i].config.cpuHotAddEnabled;
Memory = VMs[i].config.cpuHotAddEnabled;
}
}
That's it :)
http://manuelpaeth.blogspot.de/2013/06/powershell-and-vcenter-orchestrator.html


Keine Kommentare:

Kommentar veröffentlichen