VMware Cloud Community
jingleharish
Contributor
Contributor
Jump to solution

Need DS Report

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.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

Reply
0 Kudos
5 Replies
DPike
Enthusiast
Enthusiast
Jump to solution

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/

_________________ Dustin Pike VMware Certified Professional (VI3 & vSphere) Virtual Blocks Blog
Reply
0 Kudos
mrksiddiqui
Enthusiast
Enthusiast
Jump to solution

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

http://communities.vmware.com/message/1122500

Hope this helps.

Message was edited by: mrksiddiqui

If this helps answer your question please consider awarding points!
Reply
0 Kudos
jingleharish
Contributor
Contributor
Jump to solution

Yes, Its for all datastores.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
jingleharish
Contributor
Contributor
Jump to solution

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.
Reply
0 Kudos