RSS

powershell做报表:给输出加个标题和表达式

15 Dec

Get-MailboxStatistics  yangxun | ft displayname, totalitemsize

Get-MailboxStatistics  yangxun | ft displayname, @{ expression={$_.TotalItemSize.Value.ToKB()} }

Get-MailboxStatistics  yangxun | ft displayname, @{ expression={$_.TotalItemSize.Value.ToKB() } ;label=”TotalItemSize (KB)” }

 

具体这些操作都是啥意思可以运行下面的命令

$a = get-mailbox |Get-MailboxStatistics

$a[0].TotalItemSize | Get-Member

$a[0].TotalItemSize.Value | Get-Member

结果图

   1: [PS] C:\Documents and Settings\yangxun>$a = get-mailbox yangxun* |Get-MailboxSta
   2: tistics
   3: [PS] C:\Documents and Settings\yangxun>$a[0].TotalItemSize | Get-Member
   4:  
   5:  
   6:    TypeName: Microsoft.Exchange.Data.Unlimited`1[[Microsoft.Exchange.Data.ByteQ
   7: uantifiedSize, Microsoft.Exchange.Data, Version=8.0.0.0, Culture=neutral, Publi
   8: cKeyToken=31bf3856ad364e35]]
   9:  
  10: Name            MemberType Definition
  11: ----            ---------- ----------
  12: CompareTo       Method     System.Int32 CompareTo(Unlimited`1 other), System...
  13: Equals          Method     System.Boolean Equals(Object other), System.Boole...
  14: GetHashCode     Method     System.Int32 GetHashCode()
  15: GetType         Method     System.Type GetType()
  16: get_IsUnlimited Method     System.Boolean get_IsUnlimited()
  17: get_Value       Method     Microsoft.Exchange.Data.ByteQuantifiedSize get_Va...
  18: set_Value       Method     System.Void set_Value(ByteQuantifiedSize value)
  19: ToString        Method     System.String ToString()
  20: IsUnlimited     Property   System.Boolean IsUnlimited {get;}
  21: Value           Property   Microsoft.Exchange.Data.ByteQuantifiedSize Value ...
  22:  
  23:  
  24: [PS] C:\Documents and Settings\yangxun>$a[0].TotalItemSize.Value | Get-Member
  25:  
  26:  
  27:    TypeName: Microsoft.Exchange.Data.ByteQuantifiedSize
  28:  
  29: Name          MemberType Definition
  30: ----          ---------- ----------
  31: CompareTo     Method     System.Int32 CompareTo(ByteQuantifiedSize other)
  32: Equals        Method     System.Boolean Equals(Object obj), System.Boolean E...
  33: GetHashCode   Method     System.Int32 GetHashCode()
  34: GetType       Method     System.Type GetType()
  35: RoundUpToUnit Method     System.UInt64 RoundUpToUnit(Quantifier quantifier)
  36: ToBytes       Method     System.UInt64 ToBytes()
  37: ToGB          Method     System.UInt64 ToGB()
  38: ToKB          Method     System.UInt64 ToKB()
  39: ToMB          Method     System.UInt64 ToMB()
  40: ToString      Method     System.String ToString(), System.String ToString(St...
  41: ToTB          Method     System.UInt64 ToTB()
Advertisements
 
Leave a comment

Posted by on December 15, 2009 in Powershell

 

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

 
%d bloggers like this: