My post about reverting your HAL triggered Alanrenouf to create a short, but very cool script that compares the amount of cpu’s to the windows HAL you’ve chosen. This way you will know within a second if you need to change the HAL of any of your vm’s! Cool stuff:
connect-viserver MYVISERVER
$myCol = @()
ForEach ($VM in (Get-VM))
{
$MyDetails = “” | select-Object Name, HAL, NumvCPU
$MYDetails.Name = $VM.Name
$Hal = Get-WmiObject -ComputerName $VM.Name -Query “SELECT * FROM Win32_PnPEntity where ClassGuid = ‘{4D36E966-E325-11CE-BFC1-08002BE10318}'” | Select Name
$MYDetails.HAL = $Hal.Name
$MYDetails.NumvCPU = $VM.NumCPU
$myCol += $MYDetails
}
$myCol
wally says
Hmm, not the expected result:
ERROR: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
What account is used for the wmi query ?
Chris Dearden says
sounds like a great script although I’m getting Invalid query entries on the get-WMI stage.
Chris Dearden says
Wally,
I found that I had to run powershell under my Domain Admin credentials instead of just loggin into VC with my elevated permisssions.
Duncan Epping says
it needs the domain admin probably to access the other machines…
Sven says
Hi, I get a error
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
Lennard says
If you’re getting Invalid Query results, check the quotes when you paste the script into a file. The single and double quote characters are stylised open/close quotes, and not the ambiguous ‘” style.