Highlighted
Contributor
Contributor

Power CLI newbie

Hi Everyone,

I am a newbie with Power CLI, and I have been battling to get a report that provide me with the following for VMGuests :Alotted CPU, Alotted Memory, Used Disk space all in the same report in a CSV format.

This is what I have thus far

Get-VM | `

  Select-Object Name,@{N="UsedSpaceMB";E={[math]::Round($_.UsedSpaceGB*1KB,0)}},NumCpu,MemoryMB,

    @{N="SnapshotSizeMB";E={[math]::Round(($_ | Get-Snapshot | Measure-Object -Property SizeMB -Sum).Sum,0)}} | `

  Format-Table -AutoSize | Out-File C:\_localdata\vmware\powershell\VMsReport.txt

I cant get it to go to CSV and retai nthe information

any help would be appreciated

0 Kudos
3 Replies
Highlighted
Expert
Expert

Simply change this line:

Format-Table -AutoSize | Out-File C:\_localdata\vmware\powershell\VMsReport.txt

To:

Export-Csv C:\_localdata\vmware\powershell\VMsReport.csv -notypeinformation

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
Highlighted
Contributor
Contributor

Thanks Chris,

That did the trick Smiley Happy

0 Kudos
Highlighted
Contributor
Contributor

Thank You

0 Kudos