Hello,
i have to register some VMs on a Datastore in vCenter inventory.
Bur i have the problem that powershell can't find vmstore:*
an example:
$theds = Get-Datastore "powershell_b"
Write-Host $theds.DatastoreBrowserPath
dir $theds.DatastoreBrowserPath
writes out
vmstores:\ifb-vc-02@443\Test\powershell_b
Das Laufwerk wurde nicht gefunden. Ein Laufwerk mit dem Namen "vmstores" ist nicht vorhanden.
At :line:17 char:3
+ dir <<<< $theds.DatastoreBrowserPath
where is "ifb-vc-02" the vCenter, "Test" is the datacenter and "powershell_b" the DataStore
the german message means "drive was not found. a drive with the name "vmstores" doesnt exist"
i test somthing around this problem but have no idear what is wrong.
I am using PowerCLI 4.1.1
Thank you,
Mike
Hi Mike,
I have tried your code and for me it works without any errors. I am using vCenter Server 4.1 and PowerCLI 4.1 U1.
[vSphere PowerCLI] C:\users\robert> $theds = Get-Datastore "vito_vmfs03"
[vSphere PowerCLI] C:\users\robert> Write-Host $theds.DatastoreBrowserPath
vmstores:\vito@443\VMware Infrastructure Test Omgeving\vito_vmfs03
[vSphere PowerCLI] C:\users\robert> dir $theds.DatastoreBrowserPath
Datastore path: [vito_vmfs03]
LastWriteTime Type Length Name
------------- ---- ------ ----
19-10-2010 10:27 Folder failovertest
[vSphere PowerCLI] C:\users\robert> Get-PowerCLIVersion
PowerCLI Version
----------------
VMware vSphere PowerCLI 4.1 U1 build 332441
---------------
Snapin Versions
---------------
VMWare vSphere PowerCLI 4.1 U1 build 332441
VMware vCenter Update Manager PowerCLI 4.1 build 266648
There might be something different in your environment. But I can't tell you what it is.
Regards, Robert
Hello Robert,
i use the same PowerCLI version.
The PowerShell Version is
C:\Users\schubi.IFB\Documents> $Host.Version
Major Minor Build Revision
----- ----- ----- --------
1 2 6 167
Do you use Powershell 1 or 2 ?
Best regards,
Mike
Hi Mike,
I use PowerShell V2. But I don't think the PowerShell version will make the difference.
Regards, Robert
Hi Robert,
Thanks a lot. There is realy a difference between Powershell 1 and 2.
In PowerShell 1 (my posted version) all vmstore* actions runs in an error.
same script in powershell 2 runs perfectly - so i have to upgrade to V2.
Best regards,
Mike