Hyper-V Manager tool

2

We use Hyper-V test machines in our Windows 10 environment and I put together a small PS tool in PDQ Inventory to help remote manage our Hyper-V users.

First it starts remote management on the users machine, then adds their host to my Hyper-V Manager config and launches my Hyper-V Manager with the connection to their Hyper-V server.

I'm sure this could be improved upon but maybe it could be useful to others and figured I would share;

Get-Service -Name WinRM -ComputerName $(Computer:TARGETHOSTNAME) | Start-Service

$path = "$env:APPDATA\Microsoft\Windows\Hyper-V\Client\1.0\virtmgmt.VMBrowser.config"
$target = "$(Computer:TARGET)"

if(Test-Path $path)
   {
      $ClientSettings = (Get-Content $path) -as [Xml]
      $settings = $ClientSettings.configuration.'Microsoft.Virtualization.Client.VMBrowser.BrowserConfigurationOptions'
      $settings.SelectSingleNode("//setting[@name='BrowserComputerNames']").value = $target
      $settings.SelectSingleNode("//setting[@name='PreviousSelectedServer']").value = $target
      $ClientSettings.Save($path)
      Start-Process virtmgmt.msc -Verb RunAs
   }
else
   {
      Write-Error "'$path' was not found"
   }
Cancel
login to comment
0

Thanks for sharing, sounds handy!

Cancel
login to comment

Reply