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

Comments

Leave a Reply

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)