profile for Gajendra D Ambi on Stack Exchange, a network of free, community-driven Q&A sites

Friday, July 31, 2015

Powershell guest OS report

So if you are someone who needs to audit the VMs that you deploy then you might want to look into something like this.
Let us say you want to check the report of cpu, memory on your guest VMs.
$cpuinfo = gwmi -Class Win32_Processor
$cpu = $cpuino | Select-Object Caption, NumberOfCores, NumberOfLogicalProcessors, DeviceID, Manufacturer, MaxClockSpeed, SocketDesignation
then you get

Well I do not like that long NumberOfCores and NumberOfLogicalProcessors and I want that header to be replaced with something else. Here it is

$cpuinfo = gwmi -Class Win32_Processor
$cpu = $cpuinfo | Select-Object Caption, @{Name="Core";Expression={$_.NumberOfCores}}, @{Name="Total Threads";Expression={$_.NumberOfLogicalProcessors}}, DeviceID, Manufacturer, MaxClockSpeed, SocketDesignation

Well, If you want an html report out of it then you can just check out winOSreport at my github page.

No comments:

Post a Comment