error calling get-vmdisk from remote host

Nov 30, 2009 at 12:36 PM

Hi all, in my environment with two clustered Hyper-v Server 2008 R2 hosts, when I try to get the disks of a vm from a remote Windows Server 2008 R2 with the command:

Get-VMDisk  (Select-vm -server "servername" -multi)

I get this error

Get-WmiObject : Spazio dei nomi non valido
In C:\Windows\system32\WindowsPowerShell\v1.0\Modules\hyperv\Disk.ps1:621 car:40
+                 $VMRASD = Get-WmiObject <<<<  -ComputerName $Server -Namespace $HyperVNamespace -Query "ASSOCIATORS O
F {$_} where ResultClass = MSVM_ResourceAllocationSettingData"
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand


It seems that I can't get informations from remote server; if I run the script from the host all is ok.

If I force the variable $Server in the script at the line with the error at the value of the hostname running the VM that I want to query, all is fine.

Could someone help me?

Thanks in advance for your time.


Dec 8, 2009 at 10:44 PM

You have found a bug , but I think it is fixed in the latest build.  

In that line $Server should be $_.__server   -in the old form it always queries the local server.   [You can edit the code , but better if you get the latest version]

I'm guessing that "Spazio dei nomi non valido"  translates into English as "Invalid name space" - which suggests the computer you're on hasn't got hyper-v on it , and the query is trying to run there, not on the one where the VM is.


Dec 9, 2009 at 7:59 AM

Thanks for the informations, I download the new build, give a try and post the results.


Dec 9, 2009 at 8:30 AM

It works perfectly.

Thanks for your job man, it's a fantastic job!