Hi,
I would like to get the "location" for the datastore which can be found in the VCenter GUI under summary. Does anyone know how to get that?
Thanks!
Not really I'm afraid.
I would fetch the IP address, do the lookup and replace the IP.
Something like this perhaps
$text = "netfs://10.x.x.x//vol/vol_name_01/vm_name_01/"
$array = $text.Split('/')
$array[2] = [System.Net.Dns]::GetHostByAddress([IpAddress]$array[2]).HostName.Split('.')[0]
[string]::Join('/',$array)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try something like this
Get-Datastore | Select Name,@{N="Location";E={$_.ExtensionData.Info.Url}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc.
I am using this statement which gives me the location, but I need the name of the filer, not the IP...
@{N="Location";E={$datastore.ExtensionData.Info.Url}}
The result is:
netfs://10.x.x.x//vol/vol_name_01/vm_name_01/
Now someone wants me to replace the IP with the actual filer name. Any quick ideas on how to do this? I know I can strip it, probably do an nslookup, then add it back in, but that sounds like a lot of work!
Thanks
Not really I'm afraid.
I would fetch the IP address, do the lookup and replace the IP.
Something like this perhaps
$text = "netfs://10.x.x.x//vol/vol_name_01/vm_name_01/"
$array = $text.Split('/')
$array[2] = [System.Net.Dns]::GetHostByAddress([IpAddress]$array[2]).HostName.Split('.')[0]
[string]::Join('/',$array)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Excellent, thanks Luc!