Solved

Automating tasks of Exchange2003 UserAdmin embedded in powershell

Posted on 2013-05-25
4
402 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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 basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

932 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

16 Experts available now in Live!

Get 1:1 Help Now