Hi-
In need of a DataStore report with the following field,
DSName
Type
CapacityGB
UsedSpaceGB
FreeSpaceGB
Datacenter
Netfs path
- Number of host connected to the datastore
- Host details
Your help is much appriciated, Thanks in advance.
Try this
Get-Datastore | Select Name,Type, @{N="CapacityGB";E={"{0:f0}" -f ($_.CapacityMB/1KB)}}, @{N="UsedSpaceGB";E={"{0:f0"} -f (($_.CapacityMB - $_.FreeSpaceMB)/1KB)}}, @{N="FreeSpaceGB";E={"{0:f0}" -f ($_.FreeSpaceMB/1KB)}}, @{N="Datacenter";E={$_.Datacenter.Name}}, @{N="NFS path";E={$_.Extensiondata.Info.Nas.RemoteHost + ":" + $_.Extensiondata.Info.Nas.RemotePath}}, @{N="Connected hosts";E={[string]::Join(',',($_.Extensiondata.Host | %{(Get-VIew $_.Key).Name}))}}
I'm not sure what you mean by 'host details'.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I assume you need this script to give you this information for every datastore? Or will this be for a specific one?
_________________
Dustin Pike
VMware Certified Professional (VI3 & vSphere)
http://virtualblocks.wordpress.com/
Here is a starting point for getting datastore information:
get-datastore | select object -property ID, Name, Datacenter,CapacityMB,FreeSpaceMB
Check out this link as well
Hope this helps.
Message was edited by: mrksiddiqui
Yes, Its for all datastores.
Try this
Get-Datastore | Select Name,Type, @{N="CapacityGB";E={"{0:f0}" -f ($_.CapacityMB/1KB)}}, @{N="UsedSpaceGB";E={"{0:f0"} -f (($_.CapacityMB - $_.FreeSpaceMB)/1KB)}}, @{N="FreeSpaceGB";E={"{0:f0}" -f ($_.FreeSpaceMB/1KB)}}, @{N="Datacenter";E={$_.Datacenter.Name}}, @{N="NFS path";E={$_.Extensiondata.Info.Nas.RemoteHost + ":" + $_.Extensiondata.Info.Nas.RemotePath}}, @{N="Connected hosts";E={[string]::Join(',',($_.Extensiondata.Host | %{(Get-VIew $_.Key).Name}))}}
I'm not sure what you mean by 'host details'.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This one worked fine,
Get-Datastore | Select Name,Type,
@{N="CapacityGB";E={"{0:f0}" -f ($_.CapacityMB/1KB)}},
@{N="UsedSpaceGB";E={"{0:f0}" -f (($_.CapacityMB - $_.FreeSpaceMB)/1KB)}},
@{N="FreeSpaceGB";E={"{0:f0}" -f ($_.FreeSpaceMB/1KB)}},
@{N="Datacenter";E={$_.Datacenter.Name}},
@{N="NFS path";E={$_.Extensiondata.Info.Nas.RemoteHost + ":" + $_.Extensiondata.Info.Nas.RemotePath}},
@{N="Connected hosts";E={[string]::Join(',',($_.Extensiondata.Host | %{(Get-VIew $_.Key).Name}))}} | export-csv DS_Details.csv
Thanks Luc.