The Exchange 2007 Wiki

Configure entire OU of disabled users as rooms

If you've got an OU of "users" (disabled user accts) in an AD domain that you want to create as room resources in Exchange 2007, here's a powerful PowerShell one-liner for you:

get-user -organizationalUnit "Insert-OU-Name-Here" | where-object{$_.RecipientType -eq "User"} | Enable-mailbox -Database "MBX-Server-Name-Here\MBX-Database-Name-Here" -Room

Let's take it piece by piece:

Piece 1-
get-user -organizationalUnit "Insert-OU-Name-Here" |
This will get all user accts in the OU "Insert-OU-Name-Here"

Piece 2-
where-object{$_.RecipientType -eq "User"} | Enable-mailbox
Within the above-specified OU, if an AD acct's "RecipientType" is equal to "User", it will create and enable a mailbox for that user (Note: if an account is already mailbox-enabled, the RecipientType is already set equal to "UserMailbox" and would not be affected by this command and its subsequent parameters, i.e. that acct would be ignored by this entire process).

Piece 3-
-Database "MBX-Server-Name-Here\MBX-Database-Name-Here" -Room
This specifies on which mailbox server ("MBX-Server-Name-Here") and in which database ("MBX-Database-Name-Here") the new mailbox will be located. It then specifies that the mailbox that is being created is for a room.

For this to work, each AD acct that needs to become a room resource in the specified OU has to be disabled in ADUC prior to running this PowerShell command.


Techiedude Jan-07-2008

Site

Changes
Index
Search

 

User

 

Log In
Register

 
 

Last Modified 1/8/08 7:01 AM