2011-09-16 14 views
0

Microsoft.Exchange.Data.EnhancedTimeSpanMicrosoft.Exchange.Data.ByteQuantifiedSizeを分けることができるように、それぞれ秒とバイト(またはmegs)にキャストする正しい方法は何ですか?Powershellで毎秒メガバイトを取得する

function Get-MBStats($Username = "someuser") 
{ 

$UserDetail = (Get-MailboxStatistics -Identity $Username -IncludeMoveHistory).MoveHistory[0] 
# | ft status, targetdatabase , completiontimestamp , totalmailboxsize ,overallduration -auto# 

# What is the syntax for this? 
$DataRate = $UserDetail.OverallDuration/$UserDetail.TotalMailboxSize 

New-Object PSObject -Property @{ 
Username = $Username 
Status = $UserDetail.Status 
TargetDatabase = $UserDetail.TargetDatabase 
CompletionTime = $UserDetail.CompletionTimestamp 
TotalMailboxSize = $UserDetail.TotalMailboxSize 
OverallDuration = $UserDetail.OverallDuration 
Rate = $DataRate 
} 

# Todo: GUI http://msdn.microsoft.com/en-us/magazine/hh288074.aspx # 
} 

Get-MBStats 

答えて

0

私はちょうど私が$ aが私が働いている型の変数を表し、この

$a.TotalItemSize.Value | Get-Member

を行うことにより、型のメンバを発見できることを発見しました。

はここByteQuantifiedSize

TypeName: Microsoft.Exchange.Data.ByteQuantifiedSize 

Name   MemberType Definition 
----   ---------- ---------- 
CompareTo  Method  int CompareTo(Microsoft.Exchange.Data.ByteQuantifiedSize other) 
Equals  Method  bool Equals(System.Object obj), bool Equals(Microsoft.Exchange.Data.ByteQuantifiedSize other) 
GetHashCode Method  int GetHashCode() 
GetType  Method  type GetType() 
RoundUpToUnit Method  System.UInt64 RoundUpToUnit(Microsoft.Exchange.Data.ByteQuantifiedSize+Quantifier quantifier) 
ToBytes  Method  System.UInt64 ToBytes() 
ToGB   Method  System.UInt64 ToGB() 
ToKB   Method  System.UInt64 ToKB() 
ToMB   Method  System.UInt64 ToMB() 
ToString  Method  string ToString(), string ToString(string format), string ToString(string format, System.IF... 
ToTB   Method  System.UInt64 ToTB() 

のメンバーであり、ここでEnhancedTimeSpanための部材です。

TypeName: Microsoft.Exchange.Data.EnhancedTimeSpan 

Name    MemberType Definition 
----    ---------- ---------- 
Add    Method  Microsoft.Exchange.Data.EnhancedTimeSpan Add(System.TimeSpan ts) 
CompareTo   Method  int CompareTo(System.Object value), int CompareTo(Microsoft.Exchange.Data.EnhancedTimeS... 
Divide   Method  long Divide(System.TimeSpan ts) 
Duration   Method  Microsoft.Exchange.Data.EnhancedTimeSpan Duration() 
Equals   Method  bool Equals(System.Object value), bool Equals(Microsoft.Exchange.Data.EnhancedTimeSpan ... 
GetHashCode  Method  int GetHashCode() 
GetType   Method  type GetType() 
Mod    Method  Microsoft.Exchange.Data.EnhancedTimeSpan Mod(System.TimeSpan ts) 
Multiply   Method  Microsoft.Exchange.Data.EnhancedTimeSpan Multiply(long n) 
Negate   Method  Microsoft.Exchange.Data.EnhancedTimeSpan Negate() 
Subtract   Method  Microsoft.Exchange.Data.EnhancedTimeSpan Subtract(System.TimeSpan ts) 
ToString   Method  string ToString() 
Days    Property System.Int32 Days {get;} 
Hours    Property System.Int32 Hours {get;} 
Milliseconds  Property System.Int32 Milliseconds {get;} 
Minutes   Property System.Int32 Minutes {get;} 
Seconds   Property System.Int32 Seconds {get;} 
Sign    Property System.Int32 Sign {get;} 
Ticks    Property System.Int64 Ticks {get;} 
TotalDays   Property System.Double TotalDays {get;} 
TotalHours  Property System.Double TotalHours {get;} 
TotalMilliseconds Property System.Double TotalMilliseconds {get;} 
TotalMinutes  Property System.Double TotalMinutes {get;} 
TotalSeconds  Property System.Double TotalSeconds {get;} 
関連する問題