Thursday 7 June 2012

Some more Exchange Scripts.............


Script to delete contents from Mailbox:

Note: Before running this script gives your Exchange admin account as Full Access Permission into both source and target mailbox. Change the target/source mailbox, subjectkeywords and start date according to your requirement.

Get-content C:\Powershell \users1.txt | get-mailbox | Export-Mailbox -TargetMailbox test.cloud@contoso.com -IncludeFolders "\Inbox","\Sent Items" -TargetFolder target-SubjectKeywords "exchange" -StartDate "09/14/2011"-DeleteContent -confirm: $false

CSV File format:

Alias

Test.cloud1


To display the Dismount user immediately in EMC console:

clean-mailboxdatabase-identity "RSG2"

clean-mailboxdatabase-server “Exch07”


Command to create RSG/SG in EX2K7:

New-StorageGroup –Server EXCH01 –LogFolderPath“H:\Log15" –Name “Recovery Storage Group” –SystemFolderPath “H:\Log15” –Recovery

New-MailboxDatabase–MailboxDatabaseToRecover “MBXStore01” –StorageGroup “EXCH01\Recovery Storage Group” –EDBFilePath “H:\DB01\MBXStore01.edb”

Set-MailboxDatabase -Identity "EXCH01\Recovery Storage Group\MBXStore01" -AllowFileRestore $true

Mount-Database –Identity “EXCH01\Recovery Storage Group\MBXStore01”



How to remove DOTS from powershell result

use | ft -wrap

Ex:

Get-Mailbox-ResultSize:Unlimited | ForEach {Get-ActiveSyncDeviceStatistics-Mailbox:$_.Identity} |ft -wrap identity,devicetype,DeviceUserAgent,LastSuccessSync> c:\user.csv














Hope this helps.

Expect more!!

No comments:

Post a Comment