格式化PowerCLI输出

今天抓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"就行了。

Popular posts from this blog

Moving to Blogger.com

How to Use Proxy on WSL 2

Connect-NsxtServer shows "Unable to connect to the remote server"