Scripting Exchange 2007

As you know Exchange 2007 can be totally administered by using Powerscript. Here I have tried to collect some scripts for Exchange 2007 administration:

Empty a mailbox database

List mailbox servers in an organisation

   get-mailboxserver

List maildatabases on current server

   get-mailboxdatabase

List mailboxes in maildatabase

   get-mailbox -database "Mailbox Database"

Disable a mailbox

   disable-mailbox [mailboxid]

Bulk enable mailboxes for AD users:

selects all users from AD

   get-user | where-object{$_.RecipientType –eq “User”}

Selects all users from the OU people

   get-user –organizationalUnit people | where-object{$_.RecipientType –eq “User”}
   get-user -organizationalUnit domain/OU/SUBOU | where-object{$_.RecipientType -eq "User"}

   Note: This will get you only users NOT users with mailboxes

Mailenable users from CSV file

   Import-CSV import.csv | foreach {enable-mailbox -Identity $_.Fullname -database EXCHSERVERMailbox Database"}

Where the importfile looks like this:

FullName,
Firstname Lastname, Change Booking Policy for resources
Set-MailboxCalendarSettings -Identity "Resource Name" -BookingWindowInDays 520

 

Related Links

http://exchangepedia.com/blog/2006/12/id-written-about-how-to-bulk-create.html
http://dmitrysotnikov.wordpress.com/2007/05/04/ou-management-with-powershell/
http://msexchangeteam.com/archive/2006/09/05/428833.aspx

Leave a Reply