Friday 6 July 2012

Adding few more Exchange Powershell Scripts...

To get the list of mailbox users Statistics:


Get-content C:\Users.txt | Get-MailboxStatistics | select displayname,LastLogonTime, LastLogoffTime,LastLoggedOnUserAccount,database, TotalItemSize> c:\result.txt


TXT file Format:
Test Mail
Test Mail1


You can add some more stings if you need: ItemCount, DisconnectDate, DeletedItemCount


To find Manual quota is defined or not for Bulk users:


Copy below script into txt file and change into .ps1
----------------------------
$CSV = Import-Csv "C:\Powershell\quota.csv"
$csv | Foreach {
$Indentity = $_.Alias
get-mailbox -Identity $_.Alias | Where {$_.UseDatabaseQuotaDefaults -eq $false}
}
--------------------------
CSV Format:
Alias
Test.user1
Test.user2




To get the list of mailbox users Statistics:


Get-content C:\Users.txt | Get-MailboxStatistics | select displayname,LastLogonTime, LastLogoffTime,LastLoggedOnUserAccount,database, TotalItemSize> c:\result.txt


TXT file Format:
Test Mail
Test Mail1


You can add below stings if you need: ItemCount, DisconnectDate, DeletedItemCount




To find Manual quota is defined or not for Bulk users:


Copy below script into txt file and change into .ps1


------------------------------
$CSV = Import-Csv "C:\Powershell\quota.csv"
$csv | Foreach {
$Indentity = $_.Alias
get-mailbox -Identity $_.Alias | Where {$_.UseDatabaseQuotaDefaults -eq $false}
}
-----------------------------


CSV Format:
Alias
Test.User1
Test.user2


Get Database Quota Result for all Mailbox servers:
Get-MailboxDatabase | Select-Object ServerName,Name,IssueWarningQuota,ProhibitSendQuota,ProhibitSendReceiveQuota | Sort-Object Name | Export-Csv d:\DatabaseLimits.csv –NoTypeInformation




Apply Quota for Bulk Database:
Copy below to TXT file and convert into .PS1
----------------
$csv = import-csv "C:\Powershell\DB\DB.csv"
$csv | Foreach {
Set-MailboxDatabase-Identity $_.DB -IssueWarningQuota 900MB-ProhibitSendQuota 1024MB-ProhibitSendReceiveQuota 8192MB
}
---------------
CSV Format:
DB
EXCH01\SG1\MBXStore1
EXCH02\SG2\MBXStore2
EXCH03\SG3\MBXStore3


ActiveSync users list with Policyname and server:


Get-CASMailbox -Filter {ActiveSyncMailboxPolicy -eq $ActiveSyncPolicyName} |ft Displayname, ActiveSyncMailboxPolicy, Servername


Active Sync users search by Policy Name:
Get-CASMailbox | where{$_.activesyncmailboxpolicy -match“Default”} | ft Displayname



Hope this help!!!