foreach ($vm in (get-vm)) {
$props = @{'VMName'=$vm.Name;
'IP Address'= $vm.Guest.IPAddress[0];
'PowerState'= $vm.PowerState;
'Domain Name'= ($vm.ExtensionData.Guest.Hostname -split '\.')[1,2] -join '.';
'vCPU'= $vm.NumCpu;
'RAM(GB)'= $vm.MemoryGB;
'Total-HDD(GB)'= $vm.ProvisionedSpaceGB -as [int];
'HDDs(GB)'= ($vm | get-harddisk | select-object -ExpandProperty CapacityGB) -join " + "
'Datastore'= (Get-Datastore -vm $vm) -split ", " -join ", ";
Is it possible to find the Netapp vServer ip (NFS server ip) as well in above ?
Get-Datastore -vm XXX does shows
RemoteHost | RemotePath | UserName | AuthenticationMethod | FileSystemVersion | DatacenterId | Datacenter | ParentFolderId | ParentFolder | DatastoreBrowserPath | FreeSpaceMB | CapacityMB | Accessible | Type | StorageIOControlEnabled | CongestionThresholdMillisecond | State | ExtensionData | CapacityGB | FreeSpaceGB | Name | Id | Uid | Client |
but the remote host ip does not seen even in normal export
I modified it a bit
'vServer' = (Get-datastore -vm $vm).ExtensionData.info.nas.remotehost
it does not give info when vm has 2 Data Stores tho, then it shows
System.Object[] |
I don't have anything to try but what comes to my mind just now would be :
$vServer = (Get-datastore -vm $vm) | foreach-object {$_.ExtensionData.info.nas.remotehost}
If you're querying several VMs that have the same datastores you might want to add select unique to avoid getting multiple occurences
$vServer = (Get-datastore -vm $vm) | foreach-object {$_.ExtensionData.info.nas.remotehost} | select -unique