?
Solved

Delete Mailbox account and create contact Powershell

Posted on 2014-03-18
7
Medium Priority
?
383 Views
Last Modified: 2014-04-12
I'm running MS exchange 2007.
I'm looking for a powershell script to delete bulk mailbox and create new contact.
however the new contact should include all the mailbox information (e.g. X500, smtp address, and user information such as phone number/title/etc)
0
Comment
Question by:gavintham
[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
  • 4
  • 3
7 Comments
 
LVL 5

Expert Comment

by:Arjun Vyavahare
ID: 39936505
Hi,

To delete bulk mailboxes from Exchange 2007, refer:-

http://randomtechminutia.wordpress.com/2012/05/03/powershell-script-to-delete-exchange-mailboxes-in-mass/

To create bulk mailboxes in exchange 2007, refer:
http://blogs.technet.com/b/exchangept/archive/2007/10/04/bulk-creation-of-exchange-2007-mailboxes.aspx

I hope this will help you.

Regards,
Arjun
0
 

Author Comment

by:gavintham
ID: 39938726
Hi Arjun,

Thanks for you post.

I want to replace the user mailbox with new contact.

i want to retrieve all existing user mailbox detail out then perform delete.
after deleted then will create new contact of these users with the complete information.(e.g. X500, smtp address, and user information such as phone number/title/etc)

the article that you post only single solution. hope to hear you for more help.

Thanks
Gavin
0
 
LVL 5

Expert Comment

by:Arjun Vyavahare
ID: 39938808
Hi,

Try to run below command and see if you can get any clue:

get-mailbox -server Server_name -resultsize unlimited | get-user | select DisplayName, Title, Manager, Department | export-csv "c:\temp\info.csv"

Regards,
Arjun
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:gavintham
ID: 39952476
hi Arjun,

if i want to export the complete information. (LegacyDN - x500, SMTP Address, DisplayName, Title, Manager, Department)

after that i need to to add all these information into new contact.

how to combine all these thing into a script?

Thanks
Gavin
0
 

Accepted Solution

by:
gavintham earned 0 total points
ID: 39968725
hi Arjun,

thank you for your advise. sorry to say that your solution is not completed.
anywhere i found it from other article and my program similar as below

foreach($Acc in $users)  
{
$userMailbox = get-mailbox $Acc -ResultSize Unlimited
$UserRecipient = get-recipient $Acc -ResultSize Unlimited
$UserAD = get-user $Acc -ResultSize Unlimited

$UserCompany = $userRecipient.company
If($UserCompany -eq $null){$UserCompany = ""}

$strOutput = $userRecipient.FirstName + "," +  $userRecipient.LastName + "," +  $userRecipient.displayname + "," + $userRecipient.name + "," + $userRecipient.Initials + "," + $userRecipient.alias  + "," + $userRecipient.PrimarySMTPAddress + "," +  $userreceipient.manager + "," +  $userRecipient.City + "," +  $userRecipient.PostalCode + "," +  $userRecipient.CustomAttribute1 + "," +  $userRecipient.CountryOrRegion + "," +  $userRecipient.Office + "," + $userRecipient.phone + "," + $userRecipient.StateOrProvince + "," + $userRecipient.ExternalEmailAddress + "," + $userRecipient.OrganizationUnit + "," + $UserMailbox.ForwardingAddress + "," + $UserMailbox.AcceptMessagesOnlyFrom + "," + $UserMailbox.AcceptMessagesOnlyFromDLMembers + "," +  $UserMailbox.LegacyExchangeDN + "," + $userRecipient.title + "," +  $userRecipient.department + "," + $UserAD.Fax + "," + $UserAD.HomePhone + "," + $UserAD.MobilePhone + "," + $UserAD.OtherFax + "," + $UserAD.OtherHomePhone + "," + $UserAD.OtherTelephone + "," + $UserAD.TelephoneAssistant + "," + ($UserCompany).toString()
}
0
 

Author Closing Comment

by:gavintham
ID: 39995845
full script
0

Featured Post

Problems using Powershell and Active Directory?

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

This article explains how to install and use the NTBackup utility that comes with Windows Server.
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…
Suggested Courses

770 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