Turbo Tip: Powershell ISE Trick for Hyper-v

Document created by will.searle Expert on Sep 14, 2015Last modified by fran.schwarzmann on Mar 3, 2017
Version 5Show Document
  • View in full screen mode

*** WMI has been replaced by WSMan in VMTurbo 5.4. Please use the following documents either with GPO or without GPO for newer versions of VMTurbo and before upgrading to 5.4 ***

Hi All,


I wanted to share a neat trick to help speed up the process for changing the registry keys on hosts required for VMTurbo to discover and control Hyper-v environments. The process is fairly simple, and allows you to run a script in powershell ISE that will push out registry key changes to every host in the environment all at once. Essentially eliminating the need to login to every host or creating a GPO.



1)  First, open up a remote connection into one of the hyper-v hosts within your environment.  Make sure you login to the host with local admin credentials and the account that you want to take ownership of the keys. Thus, if you created a service account for VMTurbo not only should that account have local admin credentials on all hosts, but you must login to the hyper-v server with the service account.  Then, you need to download the attached powershell script that automatically changes the appropriate registry keys to this machine.

2)  Next, open up the powershell script in Notepad ++, and save it as default name "Enable-WMI-v2.ps1".

3)  Create another tab in the same document and create a list of every Hyper-v host in the environment and you MUST SAVE THE TAB WITH THE NAME "VMs".  I know this is confusing because it is a list of hosts but windows has canned definitions for certain keywords (one of them being hosts) and this will cause the script to fail in powershell ISE. Save the file locally to the machine you are working from.

Image for GC post.PNG

4)  Now open up Powershell ISE as an administrator and copy the commands below directly into the scripting engine.  Notably, just make sure you adjust the file paths for each of the Notepad ++ tabs (circled in red). 


                    $VMs = gc C:\admin\VMs.txt


                    Foreach ($VM in $VMs)



                         write-host $VM

                         invoke-command -ComputerName $VM -FilePath C:\admin\Enable-WMI-v2.ps1




5) Now run the script you created in powershell ISE and if successful you should see responses similar to:




                     Key Opened: HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\CLSID\{76A64158-CB41-1101-8802-006008060986}

                     Key Opened: HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\CLSID\{76A64158-CB41-1101-8802-006008060986}

                     Key Opened: HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\Wow6432Node\CLSID\{76A64158-CB41-1101-8802-006008060986}

                     Key Opened: HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\Wow6432Node\CLSID\{76A64158-CB41-1101-8802-006008060986}"

1 person found this helpful