格式化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″就行了。

Advertisements

Author: Wu

VCP, MCSE, CCNA

1 thought on “格式化PowerCLI输出”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s