• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 427
  • Last Modified:

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
0
Mandy_
Asked:
Mandy_
  • 2
  • 2
1 Solution
 
Meir RivkinFull stack Software EngineerCommented:
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
 
Mandy_Author Commented:
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
 
Meir RivkinFull stack Software EngineerCommented:
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
 
Mandy_Author Commented:
yes i've finished pls see other topic  thank you
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

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now