Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delete Mailbox account and create contact Powershell

Posted on 2014-03-18
7
Medium Priority
?
385 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
I don't pretend to be an expert at this, but I have found a few things that are useful. I hope that sharing them here will help others, so they will not have to face some rather hard choices. Since I felt this to be a topic of enough importance and…
how to add IIS SMTP to handle application/Scanner relays into office 365.
This video discusses moving either the default database or any database to a new volume.

618 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