?
Solved

Automating tasks of Exchange2003 UserAdmin embedded in powershell

Posted on 2013-05-25
4
Medium Priority
?
422 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_
[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
  • 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 1500 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

Bringing Advanced Authentication to the SMB Market

WatchGuard announces the acquisition of advanced authentication provider, Datablink, with one mission – to bring secure authentication to SMB, mid-market, and distributed enterprises with a cloud-based solution, ideal for resale via their established channel & MSSP community.

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

765 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