How to detect programatically that the windows 7 has Hyper-V tools enabled

hyper-vwindows 7

I need to detect in Windows 7 programatically that the hyper-V tools are enabled. I use this powershell script in Windows Server 2008

import-module servermanager
(Get-WindowsFeature Hyper-V).Installed

Best Answer

I'm assuming you mean the RSAT tools, which have Hyper-V manager in them?

If so they are not a feature in Win7, so the method you list wouldn't work. Instead, RSAT is listed as a hotfix, so the easiest way to check from Powershell would be to check if the hotfix associated with RSAT is installed. The hotfix ID is KB958830, so you can query hotfixes from WMI with the command:

get-wmiobject -query 'select * from win32_quickfixengineering' |where {$_.HotFixID -eq 'KB958830'}

if you get 1 row back, the hotfix (and therefore RSAT, and therefore Hyper-V manager) are installed, otherwise it is not.