Solved

Automating tasks of Exchange2003 UserAdmin embedded in powershell

Posted on 2013-05-25
4
399 Views
Last Modified: 2013-05-26
Hi,

i like to handle some exch2003 user administrations within powershell together with
exchange2010.

the specific exchange task should be: mailbox-enable and mailbox-disable
Set 2nd. smtp and custom mailadress

I know about this freetool called exchMbx but only for enable-mbx
www.joeware.net/freetools/tools/exchmbx/

appreciate for your help
mandy
0
Comment
Question by:Mandy_
  • 2
  • 2
4 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39197499
can u be more specific?
what kind of powersehll code u need exactly?
do u have a list of users which u wish to enable/disable their mailbox?
can u post an ordered list of things u wish to accomplish?
0
 
LVL 2

Author Comment

by:Mandy_
ID: 39197664
csv
for the picture and the attached CSV i've created a script with someone else of the forum to
handle Bulk User Accounts for Exchange 2010 to enable,disable Mailboxes, passwort reset,
set smtp. Pls see the script below. Unfortunately we still have Exchange 2003. In the
CSV under column Version. If there a MSXC instead a MSXC2010 these are still 2003 user.

I cannot handle this existing adAccounts with the same script like 2010Accounts.
Sure i could set the password and with the tool Exchmbx from above i think i could
enable 2003 Mailboxes. All specific commands to handle mailboxes not working.

Maybe you have an idea how can i automate the complete Orders incl. 2003 User.

Here's the script i'm still finished today with a lof of help.

Import-Module ActiveDirectory

ForEach ($user in  Import-Csv "c:\export.csv"){#$user}

  
    If($user.Action -like "new") {
        If($user.Version -like "MSXC2010") {
 
        #user which have department EMC should not use the standard database

            $DBuser = (Get-ADUser -identity $user.UserID).department
            If ($DBuser -like "*EMC*") {

                $db = "DBEMC00$("{0:00}" -f (1..45 | Get-random))"
                Enable-Mailbox -Identity $user.UserId -Database $db
                
            } else {
                Enable-Mailbox -Identity $user.UserId
				write-host -ForegroundColor green "Mailbox has been enabled"
            
              } 
    # set custom attributes and @MRS and secondary smtp	 . later
    # Set-Mailbox -CustomAttribute3 'Q' -CustomAttribute12 'ER' -CustomAttribute11 'EMC' -#SingleItemRecoveryEnabled $true -Identity $User.userid
    # Set-Mailbox identity $user.UserId -EmailAddresses #smtp:$user.userid@dlh.de,MRS:$user.userid@mrs
       } 
	 If($user.Product -like "ADAccount") { 
    
	 
            $NewPassword = $user.UserId.Insert(5,"$")
            $NewPassword = $newPassword.Insert(3,"E")
            $NewPassword = $newPassword.Remove(0, 1)
            $newPassword = $newPassword.Insert(0,"T")
            Set-ADAccountPassword -Identity $user.UserId -Reset -NewPassword (ConvertTo-SecureString -AsPlainText $newPassword -Force)	  
            write-host -ForegroundColor yellow "Password has been set to $newPassword" 
       
       
       }
#write orderid to description
	$descnew = $user.orderid
    $desccurrent = (Get-ADUser -identity $user.userid -Properties Description).Description
    set-aduser -identity $user.userid -description ($desccurrent+"/"+$descnew)
    #   }
    
#disable mailbox exchange 2010

      } ElseIf($user.Action -like "delete") {

        If($user.Version -like "MSXC2010") {
		 $dbnew = (Get-Mailbox -Identity $user.userid | Select-Object Database)
		 $desccurrent = (Get-ADUser -identity $user.userid -Properties Description).Description
         set-aduser -identity $user.userid -description ($desccurrent+"/"+$dbnew)
            
		 Disable-Mailbox -Identity $user.UserID -confirm:$false
            
	     write-host -ForegroundColor Magenta "Mailbox $User has been disabled"
        }
      
			
        }  
	}

Open in new window


Appreciate for your help
Mandy

ps: first the csv has to be convert with this command
(import-csv -delimiter ';' c:\temp\Export_test.csv | sort product, version -descending | convertto-csv -notype ) -replace "\uFEFF" | out-file c:\export_51.csv -encoding utf8

Open in new window

Export.csv
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39197669
i posted a fix to your script in other question and i see u didn't used it and its too bad.
that will help you solve this issue.
have u took the time to look at it?
0
 
LVL 2

Author Comment

by:Mandy_
ID: 39197874
yes i've finished pls see other topic  thank you
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In this video we show how to create an email address policy 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…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now