I used to use PowerCLI to generate the VM inventory report, now I make it available in vCO as well.
The scripts defined in the ‘VM Inventory’ script block.
var vms = VcPlugin.getAllVirtualMachines();
var Name, Status, Power, OS, IP, CpuCore, RAM, ToolVer, Des, Log, Log1;
var Num = 0, NumOn = 0, NumOff = 0;
content = “<table border=’1′><br><tr><br><th>VM Name</th><br><th>Health Status</th><br>\
<th>Power Status</th><br><th>Operating System</th><br><th>IP Address</th><br><th>CPU Cores</th><br>\
<th>Memory</th><br><th>VMware Tools Version</th><br><th>Description</th><br></tr><br>”;
for(i in vms){
var vm = vms[i];
vmInfo(vm);
Log = “Name:” + Name + ” |Status:” + Status + ” |Power:” + Power + ” |OS:” + OS + ” |IP:” + IP + ” |CPU:” + CpuCore + ” |Memory:” + RAM + “GB” + ” |VMware tools version:” + ToolVer + ” |Description:” + Des;
Log1 = “<tr><br><td>” + Name + “</td><br><td>” + Status + “</td><br><td>” + Power + “</td><br><td>” + OS + “</td><br><td>” + IP + “</td><br><td>” + CpuCore + “</td><br><td>” + RAM + “GB</td><br><td>” + ToolVer + “</td><br><td>” + Des + “</td><br></tr><br>”;
System.log(Log);
content = content + Log1;
if(Power == “poweredOn”) {NumOn = NumOn + 1;}
if(Power == “poweredOff”) {NumOff = NumOff + 1;}
Num = Num +1;
}
subject = “VM Inventory: ” + Num + ” VM, (” + NumOn + ” on, ” + NumOff + ” off)”;
content = content + “</table>”;
function vmInfo(VM) {
Name = VM.name;
Status = VM.configStatus.value;
Power = VM.runtime.powerState.value;
OS = VM.guest.guestFamily;
IP = VM.guest.ipAddress;
CpuCore = VM.config.hardware.numCPU;
RAM = VM.config.hardware.memoryMB / 1024;
ToolVer = VM.config.tools.toolsVersion;
Des = VM.config.annotation;
}
The VM inventory report will be sent to the user’s email address.