Skip navigation
VMware

How to get a Datastore Report with PowerShell

Currently Being Moderated

How to get a Datastore Report with PowerShell

Posted by cpqarray on Apr 2, 2008 2:33:00 PM

This bit of code takes the output from Get-Datastore and converts it from megabytes to Gigabytes. It also labels the columms as FreespaceGB and CapacityGB.   This is from the forums as well. 

 

 

 

 

 

<code>Get-Datastore | ft name,@{ Label = "FreespaceGB"; Expression = { $_.FreeSpaceMB * 1MB / 1GB } }, @{ Label = "CapacityGB"; Expression = { $_.CapacityMB * 1MB / 1GB } } </code>

 

 

1,828 Views


Apr 10, 2008 8:27 AM jfierberg jfierberg    says:

This does not work.  The ft returns the following error: out-lineoutput : Object of type "Microsoft.PowerShell.Commands.Internal.Format.

FormatStartData" is not legal or not in the correct sequence. This is likely ca

used by a user-specified "format-table" command which is conflicting with the d

efault formatting.

Apr 14, 2008 8:59 AM cpqarray cpqarray    says in response to jfierberg:

I just ran the command again and it worked.  Want me to send you a script and see if you get the same error?

Jun 25, 2009 10:12 AM JimmyDean JimmyDean    says in response to cpqarray:

Below is what i get taking your above code pasting it in a text file saving it .ps1 Then trying to run it.

 

out-lineoutput : Object of type "Microsoft.PowerShell.Commands.Internal.FormatStartData" is not legal or not in the correct sequence. This is likely caused by a user-specified "format-table" command which is conflicting with the default formatting.

Communities