Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Powershell!? Must I? 2

Status
Not open for further replies.

JPJeffery

Technical User
May 26, 2006
600
GB
Hi, folks

I have a script that creates a user account, including a prompt for whether the account should have an Exchange 2003 mailbox (and if yes, it creates one). It works a treat.

Now we're just about ready to decommission Exchange 2003 having installed Exchange 2007. Currently though, we create the user account and mailbox, logon as the user, configure Outlook and send test mails to initialise the mailbox, then log off the user account and move the mailbox to the Exchange 2007 server and appropriate Mailbox store (which split groups of surname by first initial).

Clearly this mix of automatic/manual process will fail when we decommission the last Exchange 2003 server, so I've finally got round to looking in to editing the code to point to the new server (well, cluster) and adding code to select the right mailbox store.

But then, as I investigate through The Portal Of Google, I find rumours than you can't just use an LDAP query/command to create Exchange 2007 mailboxes like you could before with Exchange 2003 but instead you must use Powershell commands.

Frankly, EEK!

Is this true?

Am I screwed?

Can you call Powershell commands as external commands with somehting like CMD /C?

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
 
Short answer, yeah, you're screwed.

CDOEXM

CDOEXM was used to develop applications that manage the Exchange 2003 store. CDOEXM is not available in Exchange 2007 and has been replaced by the Exchange Management Shell. Existing applications built using CDOEXM cannot manage Exchange 2007 servers.

 
The swine...(M$, not you!)

:)

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
 
I would not say that you are screwed, only that you have to learn something new. PowerShell is great and Exchange 2007 makes it easy for you to learn.

With Exchange Management Console you can create the user and mailbox all in one shot.

Manually go through the process of setting up the user. At the very end of that process the Wizard will present you with the PowerShell code it is going to use to create the user. It becomes a simple task from there for you to modify it to prompt for username etc. to replace within the PowerShell command.

You will find some useful FAQs that may assist you in both the PowerShell Forum and the Exchange 2007 forum.
I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Well, yes, but I AM screwed in the sense that my lovely VB script will have become redundant, at least for creating London user accounts (our Hong Kong and New York offices are still on Exchange 2003 with no plans to upgrade them).

That would leave me with three choices:

1 - Redevelop the whole script in Powershell for all three site (which would be time consuming - er, thinking about it a bit more, would that even work for Exchange 2003 mailboxes?) OR
2 - Edit the existing code to, in the instance of the user account being London Based, either create the AD account then prompt the user to run a second, Powershell, script to create the mailbox or just prompt the user to run a second, Powershell, script to create the Mailbox (and therefore the AD account).
3 - Tell my colleagues to use the original script for HK and NY user accounts or the Powersehll script for London accounts.

It's just not elegant.

:(

Poor me.

*sniff*

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
 
You are aware that PowerShell can run VBScript code right?

Give my advice a shot. As I said, the majority of the code will be written for you in the ESM. What you will find is that what took you 30-50 lines of code in VBScript will be 4-5 lines of code in PowerShell.

Also, you CAN use PowerShell to create mailboxes for Exchange 2003. Take a look at this article:




I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
You are aware that PowerShell can run VBScript code right?
Well, only now you've told me. :)

Can VB Script and Powershell share variables?

i.e. if I write a Powershell script that kicks off the existing VB script, will the VB script's variables be passed to the Powershell?

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
 
Yes you can do that with Piping.

I was resistant to PowerShell initially too, but the more I learn about it the better I like it. Bottom line for all of us is that PowerShell is the future of Windows based management. better to embrace it that fight it.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Embrace the future?

OK, just as soon as I finish writing this BASIC program on my Compaq 80286...

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top