Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 219257

$global:defaultVIServer variable gets overwritten with datastores in PowerCLI 6.0 Release 2

$
0
0

I recently noticed some very odd behavior with the $global:defaultVIServer(s) variables.

 

The content was changing in the middle of my script; in particular $global:defaultVIServer.Name changed from

 

     10.10.10.10  to 10.10.10.10@443

 

For some reason a port number was getting pasted to the end of the name field, which failed in the Test-Connection (ping) cmdlet.

 

After some digging, I tracked it down to my use of the VMware global variable,  vmstores

The line, below overwrites $global:defaultVIServer

     $dsList = (dir -path vmstores:)

 

Code snippet

connect-VIServer $vctIP

$global:defaultVIServer | fl

$dsList = (dir -path vmstores: )

$global:defaultVIServer | fl

$dsList | fl


You can see that $global:defaultVIServer gets overwritten with the $dsList data after the dir command

Screen shots are attached. 


Minimally, I have to disconnect from my servers and reconnect to fix this.


Is there a better way to get the list of datastores (and their paths) with PowerCLI 6.0?

 

Maureen


Viewing all articles
Browse latest Browse all 219257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>