?
Solved

Exchange Power Shell Scripts

Posted on 2010-09-10
15
Medium Priority
?
513 Views
Last Modified: 2012-05-10
Hello - I need to have the following Exchange Power Shell Scripts:
1. To move a mailbox from one Exchange 2007 database to another.
2. To disconnect a mailbox from a user.
3. To connect a mailbox to a user.

Thanks
0
Comment
Question by:vhaperbaugub
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 3
15 Comments
 
LVL 32

Expert Comment

by:endital1097
ID: 33648401
move-mailbox user -targetdatabase server\sg\db
disable-mailbox user
enable-mailbox user
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33648408
enable-mailbox cmdlet (2010 link but same as 2007)
http://technet.microsoft.com/en-us/library/aa998251.aspx

0
 
LVL 49

Expert Comment

by:Akhater
ID: 33648426
1. move-mailbox UserName -database SourceDatabase -TargetDatabase TargetDatabase

2. disable-mailbox username

3. when you say connect you mean create a new mailbox ?
enable-mailbox username -database DatabaseName
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:vhaperbaugub
ID: 33648584
What I'm saying is for example a user moves from Chicago to Cleveland, the user will still be with the same company and he also wants to keep his old email. However, he will not be on the same Exchange Server\Database, and Cleveland has a different login username than Chicago. What PowerShell Scripts would I use to disconnect the user from his mailbox in Chicago, move the mail to Cleveland, and then reconnect him to the mail in Cleveland with his new username?
0
 
LVL 49

Expert Comment

by:Akhater
ID: 33648611
if it is still the same user there is no reason why his username will change from one site to another.

In all cases you cannot "move" a disconnected mailbox
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33648618
this will disable the mailbox from the current account
disable-mailbox chicago

then you reconnect
Connect-Mailbox -Identity chicago -Database "Mailbox Database" -User cleveland
http://technet.microsoft.com/en-us/library/bb201701(EXCHG.80).aspx
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33648621
however the issue you have there is the mailbox still resides in chicago
you would then want to run the move-mailbox cmdlet
0
 

Author Comment

by:vhaperbaugub
ID: 33648653
The organization that I work with changes the username to match the location that the user is at. If not move, can it be copied from one location to another and then deleted?
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33648673
i would just rename the useraccount and move the mailbox
0
 
LVL 49

Expert Comment

by:Akhater
ID: 33648687
since they are on the same server just different databases it would be

move-mailbox olduser -database newdb
disable-mailbox olduser
connect-mailbox olduser -user newuser

however, if my memory serves me right, you cannot connect the mailbox of a user to another user as long as the original user exists so you should replace the disable-mailbox by remove-mailbox which will delete the account from AD
0
 
LVL 49

Expert Comment

by:Akhater
ID: 33648693
"i would just rename the useraccount and move the mailbox"

seconded !
0
 

Author Comment

by:vhaperbaugub
ID: 33648700
Renaming the user account will work if they are located in the same Domain, but what would I need to do if they were not.
0
 
LVL 49

Accepted Solution

by:
Akhater earned 2000 total points
ID: 33648716
rename it and use the move tree utility
http://support.microsoft.com/kb/238394
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33648717
then you need to create the new account, disable the current mailbox, and connect the new account to the mailbox, move the mailbox

commands given earlier
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33648723
good call, forgot about that tool
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question