PowerCLI: More HAL Information

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:

image

For advice on how to convert the HAL you are using follow these steps over on vmetc.com

8 thoughts on “PowerCLI: More HAL Information

  1. Mahesh

    Can you please provide me a script which would generate a result of VMs with disconnected network in the vCenter.

  2. Johnsanjay

    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 :

  3. Pingback: vNiklas Virtualization blog » Use of PowerCLI and invoke-script to get HAL running of Windows VM´s

  4. Robert van den Nieuwendijk

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.