Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Hyper-V Manager tool

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"
   }
0

Comments

1 comment
Date Votes
  • Thanks for sharing, sounds handy!

    0