Wu's Blog

Wu's Blog

My IT Adventure

格式化PowerCLI输出

Written by

Wu Zheng

in

中文

今天抓Snapshot快照大小时发现输出值太长了,类似这张图。

070416_0556_FormattingO1.png

English Version

如果做报表看起来就很丑。以下是如何输出只保留2位小数的方法。

$a=Get-Snapshot

$a | select Description,VM,@{Name=”SizeGB”;Expression={“{0:N2}” -f $_.SizeGB}}-VM dca-db-251

如果不想要小数,把”2″改成”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
PowerCLI PowerShell Script
←Formatting Output of PowerCLI
LRDIMM or RDIMM on ESXi hosts?→

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
  • Failed to run PowerCLI command

    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

 

Loading Comments...