Link to home
Start Free TrialLog in
Avatar of philanderson888
philanderson888

asked on

PowerShell Query - Is Virtualisation Enabled?

Hi

I have been asked to report which domain clients have Virtualisation enabled (they all have the Virtualisation chip installed on the motherboard and the processor supports it) but how would I query, using powershell, which machines have virtualisation turned on in the BIOS?

Thank you

Phil
ASKER CERTIFIED SOLUTION
Avatar of Ted Bouskill
Ted Bouskill
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of philanderson888
philanderson888

ASKER

OK I've just had a read through that page which looks interesting; I can work through that page today and see if I can get some meaningful output.

I am not stupid but please assume I am a complete, complete novice when it comes to WMI querying and also Powershell.  

Assuming I've got a PC called PC07 which I put in a text file at C:\computers.txt I can then use the powershell command

Get-Content c:\computers.txt | Get-Inventory

Now the Get-Inventory command - do I put the code

Function Get-Inventory {

PROCESS {

$os = Get-WmiObject Win32_OperatingSystem –computer $_

$bios = Get-WmiObject Win32_BIOS –computer $_

$output = New-Object PSObject

$output | Add-Member NoteProperty ComputerName $_

$output | Add-Member NoteProperty SPVer ($os.ServicePackMajorVersion)

$output | Add-Member NoteProperty BuildNo ($os.BuildNumber)

$output | Add-Member NoteProperty BIOSSerial ($bios.SerialNumber)

Write-Output $output

}

}

And save it as

C:\Get-InventoryFunction.ps1

for this to work?



Presuming I can get this to work what WMI command would I put into the

$output | Add-Member NoteProperty .... lines to get a WMI query to query if Virualisation is turned on or not??

Sorry to be a bother but please assume I am a complete, complete novice here although once I've built it once I think I'll 'get it' no problem as I've been a programmer (paid one) about 20 years ago!

Thanking you in advance

Philip
You are going the right direction.  On my my Macbook right now and can't test PowerShell.  (I'm a Mac user at home, Windows at work)

Go to this site and download the tool PowerGUI http://powergui.org/index.jspa

It's a great site and tool for working with PowerShell.  I'm glad you discovered PowerShell.  It's a great language and mechanism for managing Windows.

Cheers
OK Thanks I will try

I did get the powershell commands eg

Get-WmiObject Win32_OperatingSystem –computerName Server2

to run fine but so far my attempts at running the Get-Inventory function have drawn blank output.

Also did you know the explicit WMI call to find out if virtualisation is enabled???

Regards

Phil

PS No hurry on the reply as it's really not urgent!
Hi Ted

Thanks for your input.  Today I managed to get it to work.

I didn't know how to 'call' a function as the line Get-Content c:\computers.txt | Get-Inventory

was giving me an error with unknown function 'Get-Inventory'.

I eventually worked out one way of calling the function correctly which was to create a 'Run.ps1' file with the following content

. C:\Scripts\Get-InventoryFunction.ps1

Get-Content C:\Scripts\computers.txt | Get-Inventory

and that seemed to work ie I had to explicitly name the function as part of my 'Run' script.

I am not sure if that was the 'correct' way to do it, but it worked fine for me and the export to CSV function worked fine also.

Phil
OK Ted so finally my original question looks like NOT POSSIBLE ie the mandate of this post was

"how would I query, using powershell, which machines have virtualisation turned on in the BIOS"

I have worked out how to query BIOS information eg BIOS serial number, but do you know how to tell me

1) If Hardware Virtualisation is present in the hardware

2) If it is turned ON or OFF in the BIOS

Then we are done!

Regards

Phil


PS The tool havdetectiontool.exe works on a non-scripted basis so I have already done that.
Sorry for the delay, I've been travelling for work.  That level of detail in the BIOS might not be available.  It's up to the BIOS manufacturer to decide what gets exposed to WMI

If you can find this data in the System Information panel then it is available using WMI but it might be tricky to find the right WMI syntax to retrieve it.
OK Many thanks for your help.

I did, as I wrote above, get my first Powershell script to run for multiple computers which I was quite pleased about, so that was a plus from my query.  

I resolved it by using the havdetectiontool.exe manually in the end.

As you write in your last post the information may be available but in this case it would not be worth the effort to find out so I'm going to close the call and credit you for your help.

Regards

Phil