set-vm - bug?

Mar 27, 2012 at 9:32 AM
Edited Mar 27, 2012 at 9:43 AM

Uh oh... Looks like if I call set-vm more than once, subsequent calls fail. What's up, anyone?

 

PS> import-module "C:\Program Files\modules\HyperV\hyperv.psd1"
PS> set-vm -vm HOST -server GUEST1 -autoshutdown 1 -autostartup 1 -autorecovery 1
Modified VM Global Settings object for GUEST1

PS> set-vm -vm HOST -server GUEST2 -autoshutdown 1 -autostartup 1 -autorecovery 1
Get-WmiObject : Invalid namespace
At C:\Program Files\modules\HyperV\VM.ps1:73 char:26
+             Get-WmiObject <<<<  -computername $Server -NameSpace $HyperVNamespace -Query $WQL | Add-Member -MemberTyp
e ALIASPROPERTY -Name "VMElementName" -Value "ElementName" -PassThru
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

 

Found this issue - http://pshyperv.codeplex.com/workitem/9137 - which seems similar... but other commands used multiple times don't cause this. Anyone?

AW

Apr 12, 2012 at 2:19 PM
Edited Apr 12, 2012 at 2:27 PM

Change

$HyperVNamespase = "root\virtualization"

to

$HyperVNamespase = "root/virtualization"

in En-us.ps1.

This bug only appears in PowerShell ISE.