[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 836
  • Last Modified:

create new user and mailbox process

I have a win2008 DC and a Exchange 2007 server. When I create new users I want to use as simple steps as possible, so is it recommended to create the user in AD first, then create the mailbox through ESM. Or can I use a single 'new-mailbox' command that will add all my desired info into the new account. If so how do I add (script) values of 'profile path' 'logon script' etc?

If I have to run two separate scripts (one for AD and one for mailbox) is there some kind of replication interval between being able to run the two scripts.
0
Pete
Asked:
Pete
  • 4
  • 2
1 Solution
 
flaphead_comCommented:
if you use the new-mailbox powershell command you can create an ad user account at the same time
$user     = Read-Host "Enter Username.."
$password = Read-Host "Enter Password.." -AsSecureString
$OU       = Read-Host "Enter OU........"
 
$database = "<Change this to the database path>"
$ExternalEmailAddress = $user + "@<your domain>"
$txtfile = $user + ".txt"
new-mailbox -database $database -password $password -UserPrincipalName $ExternalEmailAddress -Name $user -OrganizationalUnit $OU
get-mailbox $user 

Open in new window

0
 
PeteAuthor Commented:
thanks:
If so how do I add (script) values of 'profile path' 'logon script' etc into the new account?
0
 
flaphead_comCommented:
check out powergui (http://www.powergui.org/index.jspa) it's an addin to Powershell that lets you do more with the AD than the standard Exchange commands. All new-mailbox or even new-user will do is create a basic user.

Touching on something you mentioned before .. if you use the -DomainController switch, this should make running commands after each other okay, as they will update the same DC?
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
PeteAuthor Commented:
Thanks I like the interface of powershell but I still can't see how to create my users, can you please clarrify the process for me? -
Currently (win2003, ex2003) a new user comes and sees me and I use ADUC on the DC to create them, copying another user from the same OU\groups ete, it prompts for new mailbox and the store to put the mailbox in and I say 'OK'....great! Easy!
So HOW do I create a new user on Win2008, Ex2007? I need to specify: name, alias, OU and group membership, "profile path", "logon script" values as well as all the usual email address and managed mailbox policies etc.
This all seems very complicated.
As an aside will deleting the user in AD also delete the mailbox when they leave?
0
 
flaphead_comCommented:
ah okay ... new-mailbox and new-user is for exchange 2007

powergui and a command line too, and I think that will work with "normal" powershell

If your using exchange 2003, and powergui then yes it will leave the mail disconnected

Not really  played with powergui much, but do understand it should do what you want
0
 
flaphead_comCommented:
You are going to need the following to stuff with the AD:

http://www.microsoft.com/downloads/details.aspx?FamilyId=993c0bcf-3bcf-4009-be21-27e85e1857b1&displaylang=en

and active roles powershell add-in: http://www.quest.com/powershell/activeroles-server.aspx

Once you have installed them, you can either use powergui or ActiveRoles Management Shell for Active Directory.

Set-QADUser looks like your friend
Use this cmdlet to change or remove values of attributes of a user account in Active Directory.

The cmdlet takes a series of optional, attribute-specific parameters allowing you to make changes to user attributes in Active Directory. Thus, to modify the value of the 'givenName', 'sn', or 'l' attribute, you can use the -FirstName, -LastName, or -City parameter, respectively.

If a given attribute is referred to by both the ObjectAttributes array and an attribute-specific parameter, the ObjectAttributes setting has no effect on that attribute. The cmdlet sets the attribute to the value specified by the attribute-specific parameter.

The cmdlet has optional parameters that determine the server and the security context for the operation. Normally,the connection parameters could be omitted so far as a connection to a server is established prior to using the cmd let. In this case, the server and the security context are determined by the Connect-QADService cmdlet.

If you do not use Connect-QADService and have no connection established prior to using a cmdlet, then the connection settings, including the server and the security context, are determined by the connection parameters of the first cmdlet you use. Subsequent cmdlets will use those settings by default.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

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