如何管理Exchange 2010的Get-MoveRequest
命令的输出,以便可以在下面的$ Username变量中使用Name
变量?
[CmdletBinding(DefaultParameterSetName = "MoveUser")]
param(
[Parameter(Mandatory = $true, ParameterSetName = "MoveUser", ValueFromPipeline = $true, Position = 0)]
$Username
)
function Get-MBStats($Username )
{
$req = Get-MailboxStatistics -Identity $Username -IncludeMoveHistory
$UserDetail = ($req).MoveHistory[0]
# TODO: SOME CUSTOM STUFF HERE #
New-Object PSObject -Property @{
Username = $Username
Status = $UserDetail.Status
TargetDatabase = $UserDetail.TargetDatabase
CompletionTime = $UserDetail.CompletionTimestamp
MailboxSizeKB = $UserDetail.TotalMailboxSize.ToKB()
DurationSec = $UserDetail.TotalInProgressDuration.TotalSeconds
BadItems = $UserDetail.BadItemsEncountered
}
# Todo: GUI http://msdn.microsoft.com/en-us/magazine/hh288074.aspx #
}
Get-MBStats($Username)
更新
以下是MoveRequest(来源)
的成员输出 TypeName: Microsoft.Exchange.Management.RecipientTasks.MoveRequest
Name MemberType Definition
---- ---------- ----------
Clone Method System.Object Clone()
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetProperties Method System.Object[] GetProperties(System.Collections.Generic.ICollection[Microso...
GetType Method type GetType()
ToString Method string ToString()
Validate Method Microsoft.Exchange.Data.ValidationError[] Validate()
PSComputerName NoteProperty System.String PSComputerName=nycexhc01.nfp.com
RunspaceId NoteProperty System.Guid RunspaceId=dc444c7e-bcac-4c1c-8fdf-847875456c03
Alias Property System.String Alias {get;set;}
BatchName Property System.String BatchName {get;}
Direction Property Microsoft.Exchange.MailboxReplicationService.RequestDirection Direction {get;}
DisplayName Property System.String DisplayName {get;set;}
DistinguishedName Property System.String DistinguishedName {get;}
ExchangeGuid Property System.Guid ExchangeGuid {get;}
ExchangeVersion Property Microsoft.Exchange.Data.ExchangeObjectVersion ExchangeVersion {get;}
ExternalDirectoryObjectId Property System.String ExternalDirectoryObjectId {get;}
Flags Property Microsoft.Exchange.Data.Directory.Recipient.RequestFlags Flags {get;}
Guid Property System.Guid Guid {get;}
Identity Property Microsoft.Exchange.Data.ObjectId Identity {get;}
IsOffline Property System.Boolean IsOffline {get;}
IsValid Property System.Boolean IsValid {get;}
LastExchangeChangedTime Property System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutr...
Name Property System.String Name {get;set;}
OrganizationId Property Microsoft.Exchange.Data.Directory.OrganizationId OrganizationId {get;}
OriginatingServer Property System.String OriginatingServer {get;}
Protect Property System.Boolean Protect {get;}
RecipientType Property Microsoft.Exchange.Data.Directory.Recipient.RecipientType RecipientType {get;}
RecipientTypeDetails Property Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails RecipientTy...
RemoteHostName Property System.String RemoteHostName {get;}
RequestStyle Property Microsoft.Exchange.MailboxReplicationService.RequestStyle RequestStyle {get;}
SourceArchiveDatabase Property Microsoft.Exchange.Data.Directory.ADObjectId SourceArchiveDatabase {get;}
SourceDatabase Property Microsoft.Exchange.Data.Directory.ADObjectId SourceDatabase {get;}
Status Property Microsoft.Exchange.Data.Directory.Recipient.RequestStatus Status {get;}
Suspend Property System.Boolean Suspend {get;}
SuspendWhenReadyToComplete Property System.Boolean SuspendWhenReadyToComplete {get;}
TargetArchiveDatabase Property Microsoft.Exchange.Data.Directory.ADObjectId TargetArchiveDatabase {get;}
TargetDatabase Property Microsoft.Exchange.Data.Directory.ADObjectId TargetDatabase {get;}
以下是目标
的成员 TypeName: Microsoft.Exchange.Data.Mapi.MailboxStatistics
Name MemberType Definition
---- ---------- ----------
Clone Method System.Object Clone()
Dispose Method System.Void Dispose()
Equals Method bool Equals(System.Object obj)
GetDisposeTracker Method Microsoft.Exchange.Diagnostics.DisposeTracker GetDisposeTracker()
GetHashCode Method int GetHashCode()
GetProperties Method System.Object[] GetProperties(System.Collections.Generic.ICollection[Microsoft....
GetType Method type GetType()
SuppressDisposeTracker Method System.Void SuppressDisposeTracker()
ToString Method string ToString()
Validate Method Microsoft.Exchange.Data.ValidationError[] Validate()
PSComputerName NoteProperty System.String PSComputerName=nycexhc01.nfp.com
RunspaceId NoteProperty System.Guid RunspaceId=dc444c7e-bcac-4c1c-8fdf-847875456c03
AssociatedItemCount Property System.Nullable`1[[System.UInt32, mscorlib, Version=2.0.0.0, Culture=neutral, P...
Database Property Microsoft.Exchange.Data.ObjectId Database {get;}
DatabaseName Property System.String DatabaseName {get;}
DeletedItemCount Property System.Nullable`1[[System.UInt32, mscorlib, Version=2.0.0.0, Culture=neutral, P...
DisconnectDate Property System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral,...
DisconnectReason Property System.Nullable`1[[Microsoft.Exchange.Data.Mapi.MailboxState, Microsoft.Exchang...
DisplayName Property System.String DisplayName {get;}
Identity Property Microsoft.Exchange.Data.Mapi.MailboxId Identity {get;}
IsArchiveMailbox Property System.Nullable`1[[System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, ...
IsQuarantined Property System.Boolean IsQuarantined {get;}
IsValid Property System.Boolean IsValid {get;}
ItemCount Property System.Nullable`1[[System.UInt32, mscorlib, Version=2.0.0.0, Culture=neutral, P...
LastLoggedOnUserAccount Property System.String LastLoggedOnUserAccount {get;}
LastLogoffTime Property System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral,...
LastLogonTime Property System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral,...
LegacyDN Property System.String LegacyDN {get;}
MailboxGuid Property System.Guid MailboxGuid {get;}
MailboxTableIdentifier Property System.String MailboxTableIdentifier {get;}
MapiIdentity Property Microsoft.Exchange.Data.Mapi.MapiObjectId MapiIdentity {get;}
MoveHistory Property System.Object MoveHistory {get;}
ObjectClass Property Microsoft.Exchange.Data.Mapi.ObjectClass ObjectClass {get;}
OriginatingServer Property Microsoft.Exchange.Data.Fqdn OriginatingServer {get;}
ServerName Property System.String ServerName {get;}
StorageLimitStatus Property System.Nullable`1[[Microsoft.Exchange.Data.Mapi.StorageLimitStatus, Microsoft.E...
TotalDeletedItemSize Property Microsoft.Exchange.Data.Unlimited`1[[Microsoft.Exchange.Data.ByteQuantifiedSize...
TotalItemSize Property Microsoft.Exchange.Data.Unlimited`1[[Microsoft.Exchange.Data.ByteQuantifiedSize...
答案 0 :(得分:0)
文档不清楚Get-MoveRequest
返回的内容,但您可以尝试以下内容:
Get-MoveRequest ... | select -expand Name | Get-MBStats