【正文】
可以使用客戶端過濾,以縮小結果 : GetTransportServer | where { $ –eq $false } 通配符 GetMailbox *joe* GetExchangeServer *North* GetSendConnector *. 對內容參數(shù)的過濾 (like WhatIf): GetExCommand | Where { $ Like *WhatIf* } 通過端過濾可以返回更多的信息 GetMailbox filter { DisplayName like ?*Test*? } Finding Things Page 29 Exchange Management Shell 盡可能利用管道實現(xiàn)批量管理 GetStorageGroup | SetStorageGroup param1 arg1 param2 arg2 管理員 (cmd1 | cmd2) 使用相同的名詞 GetMailbox contoso\joe | removbox 使用不同的名詞 GetMailbox contoso\joe | TestMapiConnectivity 即使有時管道無法實現(xiàn),你可以使用 ForEach GetExchangeServer | foreach { getStoragegroup –server $ } Pipelining Page 30 Exchange Management Shell Use whatif, confirm, verbose All cmdlets except get* support –whatif Confirmation is on by default To deal with invalid configuration: Check state of returned objects $object = GetManagedFolderMailboxPolicy ELCp1 if ( $ –eq $false ) { $whatsWrong = $() $whatsWrong | selectobject InvalidData,Description,PropertyDefinition } Use set* cmdlets to fix configuration $fixedObject | SetManagedFolder Preventing Accidents Page 31 Set the send quota for ALL mail enabled users in the DL called “RemoteUsers” to 10000 KB Remove only storage groups that contain the word “temp”, with confirmation support Move ALL users from server PORTLAND to the TUCSON server, database “DB1” GetMailbox –server PORTLAND | movbox –targetDatabase “TUCSON\DB1” GetStorageGroup | where { $ –imatch “temp” } | RemoveStorageGroup –confirm GetDistributionGroup “RemoteUsers” | GetDistributionGroupMember | SetMailbox –ProhibitSendQuota 10000 Exchange Management Shell Examples Page 32 Assign an owner to a group of distribution lists Delete all messages in queue where the sender is Bob Verify the status of a storage group enabled for continuous replication G