VMware Cloud Community
antoniogemelli
Hot Shot
Hot Shot
Jump to solution

Get disk for VM

Hello,

I have several scripts to get vm info into csv file,

No idea why, but in the last period I get always long output for disk,

example:

 

UsedSpaceGBProvisionedSpaceGB
24.158.326.207.939.500.000.000.000.00025.341.041.051.689.500.000.000.000.000
24.052.384.103.182.700.000.000.000.00025.341.055.978.182.700.000.000.000.000
23.361.345.231.067.300.000.000.000.00024.541.032.731.067.300.000.000.000.000
23.337.542.755.436.100.000.000.000.00024.541.058.380.436.100.000.000.000.000
23.143.484.270.293.200.000.000.000.00024.541.042.864.043.200.000.000.000.000

This happening since I upgrade office to 365.

This is script (before got readable data)

$powerstate = @()

    foreach($vmlist in (Get-Content -Path C:\Users\geme\Desktop\AP\ALLVM.txt)){

   

    $vm = Get-VM -Name $vmlist

    $powerstate += (Get-VM $vm |

    Select Name,PowerState,Version,NumCpu,MemoryGB,UsedSpaceGB,ProvisionedSpaceGB,

   @{Name="ToolsVersion";Expression={$_.ExtensionData.Guest.ToolsVersion}},@{Name="ToolsStatus";Expression={$_.ExtensionData.Guest.ToolsVersionStatus}})

    }

    $powerstate | Export-Csv -Path C:\Users\geme\Desktop\powerstate_report.csv -NoTypeInformation -UseCulture

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

This has always been like this.

I don't know what Office365 has to do with this. Perhaps a default format in Excel has changed.

That kind of report I always had to do like this (use the [Math]::Round method)

Get-VM -Name (Get-Content -Path C:\Users\geme\Desktop\AP\ALLVM.txt) |

Select Name, PowerState, Version, NumCpu, MemoryGB,

    @{N = 'UsedSpaceGB'; E = { [math]::Round($_.UsedSpaceGB, 1) } },

    @{N = 'ProvisionedSpaceGB'; E = { [math]::Round($_.ProvisionedSpaceGB, 1) } },

    @{Name = "ToolsVersion"; Expression = { $_.ExtensionData.Guest.ToolsVersion } },

    @{Name = "ToolsStatus"; Expression = { $_.ExtensionData.Guest.ToolsVersionStatus } } |

Export-Csv -Path C:\Users\geme\Desktop\powerstate_report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

This has always been like this.

I don't know what Office365 has to do with this. Perhaps a default format in Excel has changed.

That kind of report I always had to do like this (use the [Math]::Round method)

Get-VM -Name (Get-Content -Path C:\Users\geme\Desktop\AP\ALLVM.txt) |

Select Name, PowerState, Version, NumCpu, MemoryGB,

    @{N = 'UsedSpaceGB'; E = { [math]::Round($_.UsedSpaceGB, 1) } },

    @{N = 'ProvisionedSpaceGB'; E = { [math]::Round($_.ProvisionedSpaceGB, 1) } },

    @{Name = "ToolsVersion"; Expression = { $_.ExtensionData.Guest.ToolsVersion } },

    @{Name = "ToolsStatus"; Expression = { $_.ExtensionData.Guest.ToolsVersionStatus } } |

Export-Csv -Path C:\Users\geme\Desktop\powerstate_report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

antoniogemelli
Hot Shot
Hot Shot
Jump to solution

Thanks a lot LucD , this works proper.

0 Kudos