Wu's Blog

Wu's Blog

My IT Adventure

Formatting Output of PowerCLI

Written by

Wu Zheng

in

English

Size value is too long when I grab snapshot size of a VM. It’s something like the screenshots below.

中文版

It makes the column too wide when I try run some reports. There is a simple way to keep only 2 decimals.

$a=Get-Snapshot -VM XXXX

$a | select Description,VM,@{Name="SizeGB";Expression={"{0:N2}" -f $_.SizeGB}}

If you want keep no decimals just replace the “2” with “0”.

Share this:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook
  • Share on LinkedIn (Opens in new window) LinkedIn
←2016年三亚亲子度假
格式化PowerCLI输出→

More posts

  • Fixing “Keyset Does Not Exist” When Adding a Node to a Windows Server Failover Cluster

    March 26, 2026
  • Visual Studio Code Could Not Resolve Python Interpreter Path

    March 22, 2026
  • How to Fix “PowerCLI Command Found but Module Could Not Be Loaded” in PowerShell

    December 5, 2025
  • Headset Mute Button is Not Sync with Microsoft Teams

    November 6, 2025

Search


Tags

Ansible Apple Automation Azure DevOps Hardware hyper-v IaaS IaC Image Life Microsoft network notes PowerCLI PowerShell Proxy public cloud Python raspberry pi Script security Server Terraform vCenter virtualization VMware VPN Windows Windows Server

Twenty Twenty-Five

Designed with WordPress