Create Exchange 2007 mailbox

Hi! :)

We use a vbscript to create users. Here are the lines of code in the script 
that creat the user account. The password is also set and some groups 
added...

Set objUser = objUserOU.create("user", "cn=" & strEmpid)
objUser.Put "SAMAccountName", strEmpid
objUser.Put "givenName", strFirstName
objUser.Put "sn", strLastName
objUser.Put "displayName", strLastname & " " & strFirstName
objUser.AccountExpirationDate = DateAdd("d", 1, CDate(strEndDate))

objUser.Put "userPrincipalName", strEmpid & "@" & cstrADDomainName
objUser.put "mDBUseDefaults", True
objUser.put "mailNickname", strEmpiD
objUser.put "homeMDB", cstrPrivStore
objUser.put "msNPAllowDialin", True

objUser.Setinfo


Since the upgrade to Exchange 2007 the mailboxes have been created as 
"Legacy mailbox" without Exchange 2007 functionality. To make the mailboxes 
"User mailbox"es instead we have to log inte an exchange 2007 server and run 
the powershell command: Set-Mailbox -id 
<username> -ApplyMandatoryProperties.

The description of the command is: "Creating a Exchange 2007 mailbox through 
the Exchange 2003 extensions to the Active Directory Users and Computers 
console is not supported. If an Exchange 2007 mailbox is created with this 
tool, it will be identified as a legacy mailbox, even though it resides on 
an Exchange 2007 server. Use the ApplyMandatoryProperties parameter to 
modify the mandatory properties of a mailbox in this state to correct the 
problem and remove the legacyMailbox tag from the mailbox."

What is the problem and how do I solve it?
Since the full script is a 550 lines long .hta conversion to powershell is 
not an option.

Thanks a million! :)

/Sofia


0
Sofia
3/5/2010 6:29:23 PM
scripting.vbscript 564 articles. 0 followers. Follow

3 Replies
1039 Views

Similar Articles

[PageSpeed] 59

"Sofia" <@> wrote in news:OdN8IHJvKHA.5936@TK2MSFTNGP04.phx.gbl:

> Hi! :)
> 
> We use a vbscript to create users. Here are the lines of code in the
> script that creat the user account. The password is also set and some
> groups added...
> 
> Set objUser = objUserOU.create("user", "cn=" & strEmpid)
> objUser.Put "SAMAccountName", strEmpid
> objUser.Put "givenName", strFirstName
> objUser.Put "sn", strLastName
> objUser.Put "displayName", strLastname & " " & strFirstName
> objUser.AccountExpirationDate = DateAdd("d", 1, CDate(strEndDate))
> 
> objUser.Put "userPrincipalName", strEmpid & "@" & cstrADDomainName
> objUser.put "mDBUseDefaults", True
> objUser.put "mailNickname", strEmpiD
> objUser.put "homeMDB", cstrPrivStore
> objUser.put "msNPAllowDialin", True
> 
> objUser.Setinfo
> 
> 
> Since the upgrade to Exchange 2007 the mailboxes have been created as 
> "Legacy mailbox" without Exchange 2007 functionality. To make the
> mailboxes "User mailbox"es instead we have to log inte an exchange
> 2007 server and run the powershell command: Set-Mailbox -id 
> <username> -ApplyMandatoryProperties.
> 
> The description of the command is: "Creating a Exchange 2007 mailbox
> through the Exchange 2003 extensions to the Active Directory Users and
> Computers console is not supported. If an Exchange 2007 mailbox is
> created with this tool, it will be identified as a legacy mailbox,
> even though it resides on an Exchange 2007 server. Use the
> ApplyMandatoryProperties parameter to modify the mandatory properties
> of a mailbox in this state to correct the problem and remove the
> legacyMailbox tag from the mailbox." 
> 
> What is the problem and how do I solve it?
> Since the full script is a 550 lines long .hta conversion to
> powershell is not an option.
> 
> Thanks a million! :)
> 
> /Sofia
> 
> 
> 

Sofia,

We had a simliar issue with our in-house user provisioning tool when the 
E2k7 migration started.  I tried various options and ended up with 
solution that sounds kind of clunky but actually has been 100% reliable.

Instead of setting the Exhchange attributes on the user object when it is 
created, I create a 'mail box creation' file and drop it in a shared 
directory on a server with PowerShell and ESM installed.  This MB 
creation file contains everything needed to create the MB, including the 
target server/storage group which is picked based on a load leveling 
routine (and the DC it was created on so I don't have to worry about 
replication).

A scheduled task runs once a minute looking for files in the MBQueue 
directory.  It runs a simple batch file that reads the data from the file 
and calls another batch file that runs two PS cmdlets; Enable-Mailbox and 
Set-CASMailbox (for Active Sync).  If successful it deletes the data file 
from the queue folder, otherwise it sends an email to the tech that was 
doing the user creation so they can see what went wrong.

In the 4 months we been using it, it has succesfully provisioned >1,000 
mailboxes without a single error.

Hopefully that little story will help you come up with a solution for 
your environment.

Wayne Tilton
0
Wayne
3/5/2010 10:54:59 PM
Hi Wayne and thanks for your fast reply. Unfortunally this doesn't help me 
at all. This script creates only one user and it needs to be done when the 
script is run.

1. I am requesting vbs code that creates an exch 2007 mailbox. I don't think 
this should be that hard to do...

2. I'd also like vbs code that does the same as the powershell command 
"Set-Mailbox -id
<username> -ApplyMandatoryProperties".

If I cannot find any of these I will have to run the powershell command from 
the vb-script instead. This is an acceptable solution but I'd prefer to 
learn more about how exch 2007 works and solve the problem using vbs. :)

I've been on maternity leave for two+ years and havn't had the oppurtunity 
to script for exch 2007 before now. :)

Thanks a million! :)

/Sofia



0
Sofia
3/8/2010 11:37:01 AM

"Sofia" <@> wrote in message news:#Y#5uOrvKHA.1984@TK2MSFTNGP05.phx.gbl...
> Hi Wayne and thanks for your fast reply. Unfortunally this doesn't help me 
> at all. This script creates only one user and it needs to be done when the 
> script is run.
>
> 1. I am requesting vbs code that creates an exch 2007 mailbox. I don't 
> think this should be that hard to do...

I am sure that if someone here has done it , they will tell you how.

> 2. I'd also like vbs code that does the same as the powershell command 
> "Set-Mailbox -id
> <username> -ApplyMandatoryProperties".
>
> If I cannot find any of these I will have to run the powershell command 
> from the vb-script instead. This is an acceptable solution but I'd prefer 
> to learn more about how exch 2007 works and solve the problem using vbs. 
> :)

To learn more about how exchange 2007 works is to learn more about how all 
of its administrative functionality is based on powershell. I suspect that 
anyone trying to create a vbscript-driven shell will be driven to 
distraction - even if this is only to write vbscript code to invoke the 
powershell cmdlets that do what it is you want to do.

/Al

> I've been on maternity leave for two+ years and havn't had the oppurtunity 
> to script for exch 2007 before now. :)
>
> Thanks a million! :)
>
> /Sofia
 

0
Al
3/9/2010 3:01:56 AM
Reply:

Similar Artilces:

Creating a new field based on conditions
I have a database that tracks insurance information for our various vendors. Each insurance type has 2 fields - a requirement field (yes/no), and an effective field (some show an expiration date, some are yes/no). I have created a query that will return only the records for which insurance is required but is expired/missing. My problem is that I want to create a new field that is calculated based on the values in the other two fields in order to make the resulting report more user-friendly. For example, if GLRequired is True and GLExpiration is <Now(), I want the new field to say...

Creating array of specific object types dynamically
Hi, little gotcha. Some COM objects requires array of specific type. To give you example, following DOESN'T work: [array]$X = @() However below code works: [int32[]]$X = @() For my framework, array type can be dynamic and I don't know in advance what type it's going to be. So what I would need is below: [$PropertyType[]]$X = @() This doesn't work with error message "Unable to find type". As a workaround, I solved it using following: Invoke-Expression "[$$PropertyType[]]`$Var = @()" This code works as expected, I am just curious if ...

Exchange 2000 DST Changes
How is one supposed to address the DST changes for Exchange 2000 if they do not have extended support to get the patch? Will Microsoft be providing a workaround like they did for Windows 2000? I'm referencing the following article: http://support.microsoft.com/kb/930879 It states : What to do before you run the Exchange tool Install DST updates Before you run the Exchange tool, make sure that client and server computers are updated correctly with the operating system and application DST updates. These updates must be installed in the following order: 1. Install the Windows DST upda...

Restoring Exchange 2000 cluster to "standard" Exchange 2000 Enterp
Hi all, At the moment we are creating a "full" test environment built from backup tapes from our live environment. DC's are all up and running. Our 2000 native forest exists out of a top domain and 2 child domains. All DC's are running 2000 SP3 as well as the Exchange servers. Exchange servers are located in the child domains. In one of the child domains which is NL.top.net we have an Exchange cluster, 2 nodes active/active eg. These would be EX01 and EX02 and running EX04 and EX05. Since we unfortunately do not have a SAN in our test site I will not be able to do a DR...

esm shows wrong exchange server version
I have an Exchange 2000 Installation with SP3 + Rollup package 870540-v2 + Hotfix MS05-021. Exchange System manager still shows Build 6249.4 SP3. Should ESM show a higher Build number ? Thanks for any replies. MC IIRC, ESM only shows SP4 on clustered servers that have the update applied to them. -- Neil Hobson Exchange MVP For Exchange news, links, and tips, check: http://www.msexchangeblog.com "MC" <seaedsit@hotmail.com> wrote in message news:OW%23lRuARFHA.3496@TK2MSFTNGP12.phx.gbl... >I have an Exchange 2000 Installation with SP3 + Rollup package 870540-v2 + ...

Remote Access or shared LAN access of Outlook without using Exchange Server ????
Currently I am accessing my desktop computer's installation of Outlook through Remote Desktop, from my laptop. I can do this while on the same LAN or remotely, through the internet. This however is not really ideal, as I run my desktop at QXGA resolution and my laptop has only a XGA screen. This means that when I get back home, all the windows on my desktop are all messed up and really small. What I would really like to do is be able to access remotely, in either one of the ways you can do using Exchange Server. I have a separate server machine (running Windows Server 2003 Stand...

OL2003 (Exchange) and OE6 running in the same PC
We are currently upgrading our OS from W98SE to WinXP. Our VP is using Netscape v4.67 with dial-up to access his personal email from the ISP and Novell Groupwise for his internal corporate email. With the new WinXP, he will be authenticate to Active Directory and using Exchange 2003 (Outlook 2003) for corporate email. (Yep, no more Groupwise!!) I want to move him away from Netscape to OE6 (built-in with XP pro). During my test in the lab, for some reasons I can't have OE6 and OL2003 running at the same time. (I can launch either one but not both at the same time) He wants OE6 as his...

SharePoint (WSS) 2007 / Outlook 2007 - Alert
This is a multi-part message in MIME format. ------=_NextPart_000_00AD_01C70E47.83B45950 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable We have setup a SharePoint Server (WSS) 2007 and are using the alerting = functionality. After we changes stuff on WSS, an alert message is generated and sent to = an email account. This e-mail account is hosted on an Exchange 2003 server. When using Outlook 2007 to open the e-mail, we get: Cannot open this item. Wenn using OWA the e-mail can be opene fine. Does somehow have an explanation for th...

automaticly create graph
what i would like to do is create a spread sheet where by i entered the fixed and variable costs as well as the selling price. i would then like a graph to automaicly change and display the this info. Does anyone know how to do this. Decide which cells on the spreadsheet you wish to include in the chart. Select those cells. Follow the menu option: Insert/ Chart, and answer the questions in the wizard. Have you looked in Excel help at the topics concerned with charts, starting with "Create a chart"? Have you looked at the training material under http://office.microsoft.com/...

Trying to create an Update query based on HR data to find upline V
Hi All, looking for some advice. I have an HR table that contains employee information but does not contain management chain info. Basically i am trying to determine who the employees upline VP is. The fields i have to work with are [Employee Name], [Manager Name] and [Job Title]. I figure the logic would be to check the employees' manager and if the manager is a VP (based on job title), return the manager's name to a field called [VP]. If the manager is not a VP then check that manager's manager, so on and so forth until a VP is found. Any ideas would be much appr...

Create static text from cell reference
Hey everyone... I have two columns of text which I'm combining in a third column using the formula (for C1, for example) =A1 & char(10) & B1 This gives me the contents of A1 on a line above the contents of B1 and works fine. What I NEED to do is somehow create column C as TEXT, not as a REFERENCED data from columns A and B. How do I create a cell that contains the actual TEXT content of another cell instead of a REFERENCE to the other cell? TIA... Select all the cells in "C" that have content. R-click them and select "Copy" then r-click again, sele...

NNTP move to Exchange?
Hi, I'm having a problem with getting a NNTP feed from a INND 2.2.1 server to Exchange 2003; are there any known issues here? Has anyone done this type of migration before? What issues did you encounter? It seems as if Exchange just wants to pull down a few of the groups (of which we have over 100 internal) and even with that, not even pull all of the messages in from those few groups (it usually gets a few hundred messages). I'm using the basic NNTP wizards but everything looks to be configured correctly. Thanks, Dan ...

Exchange 2003 OWA #6
Exchange 2003 OWA I would appreciate if someone would be able to help me. When I'm trying to access Exchange 2003 Server via OWA, I'm getting error "The folder can't be displayed. You do not have permission to perform this action" We also running Microsoft ISA Server. Thanks ...

Creating a Graph
hi all, i want to create a grapg dynamically getting the values from a file.. take for example the first row is the x axis and the second row is the y axis. i am planning to do this in mfc. what needs to be done for this.. if somebody has an example relating this please send me the link or the code.. thanks Read the data. Plot it. First, you have to read the data. You read the data and build an array of <x,y> pairs in whatever way you want to save them, e.g., int, float, double. This is pretty elementary programming. To do a graph in a very fancy way, you should use an existing gra...

Exchange Connector Wizard error
I received this error while trying to run this wizard for a generic CRM user(what role does it have to have?) that would accept all email directly to CRM. I ran it on a client computer (was this wrong?) Here is the error, anyway. "Failed to initialize the rule management subsystem." What is the correct procedure to run this wizard? I did not find it anywhere. Thanks! ...

Exchange Server 2000 Secuirty Setup problems
Dear I have apply wrong setting to our exchange server 2000 . The wrong setting as from exchange manager . mail store , I have apply everyone send as and receive as access right, the group included remote access via offline sync. This setting once apply , all user access other mailbox without apply access right. I have try disable this setting, after all local office user no problems, but a remote offline sync laptop user does not work . The error as below: Unable to display the folder. Microsoft Outlook could not access the specified folder location. The file C:\exchange\shawnb.ost cannot b...

Catch all outgoing email on Exchange and send copy to specified account
Hi all. I have been asked to find out if there is anyway to configure our mail server to catch all outgoing email from certain email accounts on our Exchange 2003 Enterprise server and forward a copy of this email to a specified account, also on the Exchange server. If anyone could point me in the right direction I'd be grateful. On 25 Oct 2006 04:10:54 -0700, googlegroups@tlbsolutions.com wrote: >Hi all. > >I have been asked to find out if there is anyway to configure our mail >server to catch all outgoing email from certain email accounts on our >Exchange 2003 Enterpr...

Exchange 5.5 to 2003 upgrade issue 3
We have upgraded our Exchange 5.5 server to 2003 and moved all the mailboxes and moved and re-homed the folders following the KB articles. We turned off the 5.5 services and for a week everything was working fine. Now for some reason the messages to the main distribution list is being sent to the old 5.5 server on a x400 protocol. How can I stop this and assure that the 2003 server is self contained so I can get rid of this server? ...

How do I setup an SMTP gateway / smart host for Exchange 5.5 internet bound mail
My current setup has a Windows NT 4.0 Exchange 5.5 server setting on our company LAN behind a Microsoft ISA Server. The Exchange server's Internet Mail Connector binds to (I assume this is the proper terms) port 25 on the ISA server for inbound and outbound Internet Mail. Our company has finally upgraded to a new Cisco Pix Firewall which we are able to setup a DMZ on. The suggestion by our ISP is to setup an SMTP gateway in the DMZ and have our internal Exchange server send mail to it destined for the Internet. I am aware that most of the work for making the connections from the SMTP ...

Can you create custom activities? MSCRM 3.0
Hi, Is there a way to create a new custom activity instead of customising an existing one? I have created a custom entity called 'Chat' utilising an IFRAME. All works well but this entity really should be an activity considering it's properties. In fact I've just been introduced to MS-CRM 3.0 and don't really understand what the difference is between an entity and activity. Would anyone shed the light for me? BTW, I think 3.0 looks great. Gotta admit it's improved. Cheers. Ty In my experience, you cannot create custom activities. In fact, I have been dire...

Duplicate Containers in AD after Exchange 2003 Migration
The scenario is: We migrated from an NT domain to a 2000 domain. Then about a year later we migrated from exchange 5.5 to exchange 2003. Once the migration was complete, we discovered that there were duplicate containers and OUs in "Active Directory Users and Computers" which were empty. For example, when we did the AD migration we created an OU hierarchy at the root of the domain. After the exchange migration we found a duplicate hierarchy structure under the Users container but it didnt actually contain any objects/information that was in the original OU structure. We don...

Chart printing issue in Excel 2007
A spreadsheet with charts was created using Excel 2003. I have Excel 2007 and saved it in compatibility mode. I inserted a couple colored lines on the chart and created my own legend based on these. A couple of issues: 1. When I close the file or even minimize, 2 of the colored lines on a couple of my legends disappear upon reopening. 2. When I try to print a chart, it looks good in Print Preview, but then looks magnified,half off the page, and only one of my drawn lines is printed. When someone with 2003 prints, the sizing is correct, but all of the colored drawn lines are missing...

Outlook won't conect to Exchange
Client: XP pro, Office 2003 Pro Server: Server 2003 I cannot get a client's Outlook to connect to Exchange server--or at least I THINK that's the issue. I have tried everything that I and the sys admin can think of. We've even uninstalled and re-installed the whole of Office. Out of desparation, I tried something that I thought would probably not have any impact, but it worked--temporarily. I deleted the use's mail profile, and the application opened and displayed all the users mail! I thought I was pretty close to being home free, so then I closed Outlook and re-opened...

Install 2003 after 2007?
I had Office 2003 and upgraded to 2007, other than Outlook I didn't like it. I wanted to reinstall 2003 Excel & Word. Per instructions here I uninstalled 2007 except Outlook and upon attempting to reinstall 2003 I get the error message, "Business Contact Manager requires Outlook 2003, please install Outlook 2003 before running setup". Help please. Thanks in advance... Bob Answered in the other group post "Bob Newman" <bobnewman@cox.net> wrote in message news:jH5Xl.21061$IP7.4196@newsfe23.iad... >I had Office 2003 and upgraded to 2007, other tha...

Re: Outlook 2007
I sent this 3/4 days ago but can not see it in the group. In addition after this each time I go into news groups the name of the group turns red in color?? Can not figure what this change in color means. > Each time I start Outlook jumps a message: "A data file did not close > properly > last time it was used. It will be checked.... bla, bla, bla..." > Vista ultimate, Dell computer. Could one do something?? Regards Ted > > A minute later comes up an other message that the file was checked. > Red means a subject you're following has been resp...