If you have performed Physical to Virtual (P2V) Migrations before you will know about the significance of having the correct Hardware Abstraction Layer (HAL) installed within the operating system.
Without the correct HAL you may experience a speed decrease or even a hung operating system.
For a single processor VM you will need a Uniprocessor Hal and for a multi (2-8) processor VM you will need a Multiprocessor Hal.
The following one-liner expands on my previous one-liner to include the following information:
- Name
- Number of CPUs
- HAL installed in the OS
- OS Version
- OS Service Pack Version
Note: You will need access to read WMI information from the guest operating system with the account which runs this script.
- Get-VM |Where {$_.PowerState -eq “PoweredOn“} |Sort Name |Select Name, NumCPU, @{N=“OSHAL“;E={(Get-WmiObject -ComputerName $_.Name-Query “SELECT * FROM Win32_PnPEntity where ClassGuid = ‘{4D36E966-E325-11CE-BFC1-08002BE10318}’“ |Select Name).Name}}, @{N=“OperatingSystem“;E={(Get-WmiObject -ComputerName $_ -Class Win32_OperatingSystem |Select Caption).Caption}}, @{N=“ServicePack“;E={(Get-WmiObject -ComputerName $_ -Class Win32_OperatingSystem |Select CSDVersion).CSDVersion}}
An example output from this script with using Export-CSV on the end shows us the information we need to rectify any potential VM mis-configurations:
For advice on how to convert the HAL you are using follow these steps over on vmetc.com
Can you please provide me a script which would generate a result of VMs with disconnected network in the vCenter.
I am only getting the out put like this….
Name : vmname
NumCpu : 2
OSHAL :
OperatingSystem :
ServicePack :
Name : vmname
NumCpu : 2
OSHAL :
OperatingSystem :
ServicePack :
Name : vmname
NumCpu : 8
OSHAL :
OperatingSystem :
ServicePack :
Pingback: vNiklas Virtualization blog » Use of PowerCLI and invoke-script to get HAL running of Windows VM´s
Would it be possible to include this script in your vCheck script?
I didn’t get the OSHAL with your script. The Get-WmiObject -ComputerName $_.Name-Query “SELECT * FROM Win32_PnPEntity where ClassGuid = ‘{4D36E966-E325-11CE-BFC1-08002BE10318}’“ gave an Invalid Query error on the where clause. So I changed the script to:
Get-VM |Where {$_.PowerState -eq “PoweredOn”} |Sort Name |Select Name, NumCPU, @{N=”OSHAL”;E={(Get-WmiObject -ComputerName $_.Name-Query “SELECT * FROM Win32_PnPEntity” |Where { $_.ClassGuid -eq ‘{4D36E966-E325-11CE-BFC1-08002BE10318}’ } |Select Name).Name}}, @{N=”OperatingSystem”;E={(Get-WmiObject -ComputerName $_ -Class Win32_OperatingSystem |Select Caption).Caption}}, @{N=”ServicePack”;E={(Get-WmiObject -ComputerName $_ -Class Win32_OperatingSystem |Select CSDVersion).CSDVersion}}
This version works for me.
Thank you! You often write very interesting articles. You improved my mood.
@Hal Rottenberg
Yes I finally worked out the code that converts you into a virtual Hal so we can all have our own little PowerCLI Guru.
Are you talking about me?