Link to home
Start Free TrialLog in
Avatar of Mandy_
Mandy_

asked on

Automating tasks of Exchange2003 UserAdmin embedded in powershell

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
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

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?
Avatar of Mandy_
Mandy_

ASKER

User generated image
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
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mandy_

ASKER

yes i've finished pls see other topic  thank you