Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - How to create a mailbox in Exchange 2003 using Powershell

Reply
 
Old 08-15-2007   #1 (permalink)
Tzachi


 
 

How to create a mailbox in Exchange 2003 using Powershell

thanks in advence
Tzachi

My System SpecsSystem Spec
Old 08-15-2007   #2 (permalink)
Marco Shaw


 
 

Re: How to create a mailbox in Exchange 2003 using Powershell

Tzachi wrote:
> thanks in advence
> Tzachi


Google is your friend...

http://www.developer.com/net/net/article.php/3690276

Marco

--
----------------
PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 08-15-2007   #3 (permalink)
Tzachi


 
 

Re: How to create a mailbox in Exchange 2003 using Powershell

Hey,

I tried that link, it doesnt work,
I get exceptions at this part:

#create the mailbox
(CDOEXM.IMailboxStore:
http://msdn2.microsoft.com/en-us/library/aa487566.aspx)
$ASSEMBLY_TYPE.invokemember("createmailbox",$BINDING_FLAGS,
$null,$domain_person.psbase.nativeobject,
$EXCHANGE_MAILSTORE)


It fails with the '(' part, and I am certainly not sure what is the
'http://...'part,


any idea?


thanks


"Marco Shaw" wrote:

> Tzachi wrote:
> > thanks in advence
> > Tzachi

>
> Google is your friend...
>
> http://www.developer.com/net/net/article.php/3690276
>
> Marco
>
> --
> ----------------
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>

My System SpecsSystem Spec
Old 08-15-2007   #4 (permalink)
Gaurhoth


 
 

Re: How to create a mailbox in Exchange 2003 using Powershell

If you are going to use CDOEXM, ensure you have Exchange System Manager installed on the machine you are running the powershell script from (if not the exchange server itself).

Alternatively, you can mailbox enable users without using CDOEXM, although, MS doesn't support the technique. To begin with, the example below is probably just enough to shoot yourself in the foot... so play with this in a LAB before using it in production environment.

You can use [ADSI] to set several attribute on an existing user account and the Exchange 2003 RUS component will pick up the user and finish off creating the mailbox.



$user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"

$user.mailNickname = "ptest"

$user.msExchHomeServerName = "/o=testlab/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=SITE1-03EX1"

$user.setinfo()




#wait for RUS - This can be seconds or hours depending on your Exchange configuration.



# To see the changes, reassign the modified AD object to $user

$user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"

$user | fl *



gaurhoth



"Tzachi" <Tzachi@discussions.microsoft.com> wrote in message news:A5849AA5-0EF7-48EA-8D95-47F55548B74F@microsoft.com...
> Hey,
>
> I tried that link, it doesnt work,
> I get exceptions at this part:
>
> #create the mailbox
> (CDOEXM.IMailboxStore:
> http://msdn2.microsoft.com/en-us/library/aa487566.aspx)
> $ASSEMBLY_TYPE.invokemember("createmailbox",$BINDING_FLAGS,
> $null,$domain_person.psbase.nativeobject,
> $EXCHANGE_MAILSTORE)
>
>
> It fails with the '(' part, and I am certainly not sure what is the
> 'http://...'part,
>
>
> any idea?
>
>
> thanks
>
>
> "Marco Shaw" wrote:
>
>> Tzachi wrote:
>> > thanks in advence
>> > Tzachi

>>
>> Google is your friend...
>>
>> http://www.developer.com/net/net/article.php/3690276
>>
>> Marco
>>
>> --
>> ----------------
>> PowerGadgets MVP
>> http://www.powergadgets.com/mvp
>>
>> Blog:
>> http://marcoshaw.blogspot.com
>>

My System SpecsSystem Spec
Old 08-15-2007   #5 (permalink)
Gaurhoth


 
 

Re: How to create a mailbox in Exchange 2003 using Powershell

If you are going to use CDOEXM, ensure you have Exchange System Manager installed on the machine you are running the powershell script from (if not the exchange server itself).

Alternatively, you can mailbox enable users without using CDOEXM, although, MS doesn't support the technique. To begin with, the example below is probably just enough to shoot yourself in the foot... so play with this in a LAB before using it in production environment.

You can use [ADSI] to set several attribute on an existing user account and the Exchange 2003 RUS component will pick up the user and finish off creating the mailbox.



$user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"

$user.mailNickname = "ptest"

$user.msExchHomeServerName = "/o=testlab/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=SITE1-03EX1"

$user.setinfo()




#wait for RUS - This can be seconds or hours depending on your Exchange configuration.



# To see the changes, reassign the modified AD object to $user

$user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"

$user | fl *



gaurhoth



"Tzachi" <Tzachi@discussions.microsoft.com> wrote in message news:A5849AA5-0EF7-48EA-8D95-47F55548B74F@microsoft.com...
> Hey,
>
> I tried that link, it doesnt work,
> I get exceptions at this part:
>
> #create the mailbox
> (CDOEXM.IMailboxStore:
> http://msdn2.microsoft.com/en-us/library/aa487566.aspx)
> $ASSEMBLY_TYPE.invokemember("createmailbox",$BINDING_FLAGS,
> $null,$domain_person.psbase.nativeobject,
> $EXCHANGE_MAILSTORE)
>
>
> It fails with the '(' part, and I am certainly not sure what is the
> 'http://...'part,
>
>
> any idea?
>
>
> thanks
>
>
> "Marco Shaw" wrote:
>
>> Tzachi wrote:
>> > thanks in advence
>> > Tzachi

>>
>> Google is your friend...
>>
>> http://www.developer.com/net/net/article.php/3690276
>>
>> Marco
>>
>> --
>> ----------------
>> PowerGadgets MVP
>> http://www.powergadgets.com/mvp
>>
>> Blog:
>> http://marcoshaw.blogspot.com
>>

My System SpecsSystem Spec
Old 08-15-2007   #6 (permalink)
Gaurhoth


 
 

Re: How to create a mailbox in Exchange 2003 using Powershell

For whatever reason this double posted and I wasn't even finished! Long day.

Anyway... to get the value you need for msExchHomeServerName, look at some other users and check the value. It will be dependent on your own exchange environment. There are other attributes you can fill in to force a particular mail store, etc... but for defaults - this will work.

I'll try to put a more detailed blog entry up in a day or two.

gaurhoth
http://thepowershellguy.com/blogs/gaurhoth/

"Gaurhoth" <gaurhoth@gmail.com> wrote in message news:O7ICaZ53HHA.1484@TK2MSFTNGP06.phx.gbl...
If you are going to use CDOEXM, ensure you have Exchange System Manager installed on the machine you are running the powershell script from (if not the exchange server itself).

Alternatively, you can mailbox enable users without using CDOEXM, although, MS doesn't support the technique. To begin with, the example below is probably just enough to shoot yourself in the foot... so play with this in a LAB before using it in production environment.

You can use [ADSI] to set several attribute on an existing user account and the Exchange 2003 RUS component will pick up the user and finish off creating the mailbox.



$user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"

$user.mailNickname = "ptest"

$user.msExchHomeServerName = "/o=testlab/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=SITE1-03EX1"

$user.setinfo()




#wait for RUS - This can be seconds or hours depending on your Exchange configuration.



# To see the changes, reassign the modified AD object to $user

$user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"

$user | fl *



gaurhoth



"Tzachi" <Tzachi@discussions.microsoft.com> wrote in message news:A5849AA5-0EF7-48EA-8D95-47F55548B74F@microsoft.com...
> Hey,
>
> I tried that link, it doesnt work,
> I get exceptions at this part:
>
> #create the mailbox
> (CDOEXM.IMailboxStore:
> http://msdn2.microsoft.com/en-us/library/aa487566.aspx)
> $ASSEMBLY_TYPE.invokemember("createmailbox",$BINDING_FLAGS,
> $null,$domain_person.psbase.nativeobject,
> $EXCHANGE_MAILSTORE)
>
>
> It fails with the '(' part, and I am certainly not sure what is the
> 'http://...'part,
>
>
> any idea?
>
>
> thanks
>
>
> "Marco Shaw" wrote:
>
>> Tzachi wrote:
>> > thanks in advence
>> > Tzachi

>>
>> Google is your friend...
>>
>> http://www.developer.com/net/net/article.php/3690276
>>
>> Marco
>>
>> --
>> ----------------
>> PowerGadgets MVP
>> http://www.powergadgets.com/mvp
>>
>> Blog:
>> http://marcoshaw.blogspot.com
>>

My System SpecsSystem Spec
Old 08-16-2007   #7 (permalink)
Tzachi


 
 

Re: How to create a mailbox in Exchange 2003 using Powershell

Hey,
Thanks for the answer, I appreciate it,

Well, I am not sure what's the different, I never read CDOEXM
'createMailbox' method, but I assume it just set some attributes in the user
schema,

So you think it is another way that is complete enough? have you tried that
in production environment and there were no weird issues when users opened
outlook?

Regarding my last post, sure I have the CDOEXM installed, and the code is
almost working,

I just don't get that weird part:
-------------------
#create the mailbox
(CDOEXM.IMailboxStore:http://msdn2.microsoft.com/en-us/library/aa487566.aspx)

$ASSEMBLY_TYPE.invokemember("createmailbox",$BINDING_FLAGS,$null,$domain_person.psbase.nativeobject,$EXCHANGE_MAILSTORE)
-------------------

apparently, this part is invokes the createmailbox method, which does not
work for me

If you are asking me, the author have meant to comment this line and it
jumped in the post, it is just a reference to the API of the CDOEXM methods,


This is the exception I get when the 'createmailbox' method gets invoked:

'Exception calling "InvokeMember" with "5" argument(s): "Object does not
match the type." At myscript.ps1:58 char:31 "ASSEMBLY_TYPE.invokemember( <<<<
"createmailbox, $BINDING_FLAGS,..."


So I assume this method accept other parameters,



Well, thanks a lot



"Gaurhoth" wrote:

> If you are going to use CDOEXM, ensure you have Exchange System Manager installed on the machine you are running the powershell script from (if not the exchange server itself).
>
> Alternatively, you can mailbox enable users without using CDOEXM, although, MS doesn't support the technique. To begin with, the example below is probably just enough to shoot yourself in the foot... so play with this in a LAB before using it in production environment.
>
> You can use [ADSI] to set several attribute on an existing user account and the Exchange 2003 RUS component will pick up the user and finish off creating the mailbox.
>
>
>
> $user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"
>
> $user.mailNickname = "ptest"
>
> $user.msExchHomeServerName = "/o=testlab/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=SITE1-03EX1"
>
> $user.setinfo()
>
>
>
>
> #wait for RUS - This can be seconds or hours depending on your Exchange configuration.
>
>
>
> # To see the changes, reassign the modified AD object to $user
>
> $user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"
>
> $user | fl *
>
>
>
> gaurhoth
>
>
>
> "Tzachi" <Tzachi@discussions.microsoft.com> wrote in message news:A5849AA5-0EF7-48EA-8D95-47F55548B74F@microsoft.com...
> > Hey,
> >
> > I tried that link, it doesnt work,
> > I get exceptions at this part:
> >
> > #create the mailbox
> > (CDOEXM.IMailboxStore:
> > http://msdn2.microsoft.com/en-us/library/aa487566.aspx)
> > $ASSEMBLY_TYPE.invokemember("createmailbox",$BINDING_FLAGS,
> > $null,$domain_person.psbase.nativeobject,
> > $EXCHANGE_MAILSTORE)
> >
> >
> > It fails with the '(' part, and I am certainly not sure what is the
> > 'http://...'part,
> >
> >
> > any idea?
> >
> >
> > thanks
> >
> >
> > "Marco Shaw" wrote:
> >
> >> Tzachi wrote:
> >> > thanks in advence
> >> > Tzachi
> >>
> >> Google is your friend...
> >>
> >> http://www.developer.com/net/net/article.php/3690276
> >>
> >> Marco
> >>
> >> --
> >> ----------------
> >> PowerGadgets MVP
> >> http://www.powergadgets.com/mvp
> >>
> >> Blog:
> >> http://marcoshaw.blogspot

My System SpecsSystem Spec
Old 08-17-2007   #8 (permalink)
Gaurhoth


 
 

Re: How to create a mailbox in Exchange 2003 using Powershell

Have I used it in production? No - Never had to. But I have done it in my
lab and opened mailboxes with outlook, sent mail back and forth between
accounts, and never had an issue.

gaurhoth
http://thepowershellguy.com/blogs/gaurhoth/



"Tzachi" <Tzachi@discussions.microsoft.com> wrote in message
news:6294B9CB-D551-4814-9A6A-8BE301AFD891@microsoft.com...
> Hey,
> Thanks for the answer, I appreciate it,
>
> Well, I am not sure what's the different, I never read CDOEXM
> 'createMailbox' method, but I assume it just set some attributes in the
> user
> schema,
>
> So you think it is another way that is complete enough? have you tried
> that
> in production environment and there were no weird issues when users opened
> outlook?
>
> Regarding my last post, sure I have the CDOEXM installed, and the code is
> almost working,
>
> I just don't get that weird part:
> -------------------
> #create the mailbox
> (CDOEXM.IMailboxStore:http://msdn2.microsoft.com/en-us/library/aa487566.aspx)
>
> $ASSEMBLY_TYPE.invokemember("createmailbox",$BINDING_FLAGS,$null,$domain_person.psbase.nativeobject,$EXCHANGE_MAILSTORE)
> -------------------
>
> apparently, this part is invokes the createmailbox method, which does not
> work for me
>
> If you are asking me, the author have meant to comment this line and it
> jumped in the post, it is just a reference to the API of the CDOEXM
> methods,
>
>
> This is the exception I get when the 'createmailbox' method gets invoked:
>
> 'Exception calling "InvokeMember" with "5" argument(s): "Object does not
> match the type." At myscript.ps1:58 char:31 "ASSEMBLY_TYPE.invokemember(
> <<<<
> "createmailbox, $BINDING_FLAGS,..."
>
>
> So I assume this method accept other parameters,
>
>
>
> Well, thanks a lot
>
>
>
> "Gaurhoth" wrote:
>
>> If you are going to use CDOEXM, ensure you have Exchange System Manager
>> installed on the machine you are running the powershell script from (if
>> not the exchange server itself).
>>
>> Alternatively, you can mailbox enable users without using CDOEXM,
>> although, MS doesn't support the technique. To begin with, the example
>> below is probably just enough to shoot yourself in the foot... so play
>> with this in a LAB before using it in production environment.
>>
>> You can use [ADSI] to set several attribute on an existing user account
>> and the Exchange 2003 RUS component will pick up the user and finish off
>> creating the mailbox.
>>
>>
>>
>> $user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard
>> Users,OU=Site1,DC=testlab,DC=com"
>>
>> $user.mailNickname = "ptest"
>>
>> $user.msExchHomeServerName = "/o=testlab/ou=First Administrative
>> Group/cn=Configuration/cn=Servers/cn=SITE1-03EX1"
>>
>> $user.setinfo()
>>
>>
>>
>>
>> #wait for RUS - This can be seconds or hours depending on your Exchange
>> configuration.
>>
>>
>>
>> # To see the changes, reassign the modified AD object to $user
>>
>> $user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard
>> Users,OU=Site1,DC=testlab,DC=com"
>>
>> $user | fl *
>>
>>
>>
>> gaurhoth
>>
>>
>>
>> "Tzachi" <Tzachi@discussions.microsoft.com> wrote in message
>> news:A5849AA5-0EF7-48EA-8D95-47F55548B74F@microsoft.com...
>> > Hey,
>> >
>> > I tried that link, it doesnt work,
>> > I get exceptions at this part:
>> >
>> > #create the mailbox
>> > (CDOEXM.IMailboxStore:
>> > http://msdn2.microsoft.com/en-us/library/aa487566.aspx)
>> > $ASSEMBLY_TYPE.invokemember("createmailbox",$BINDING_FLAGS,
>> > $null,$domain_person.psbase.nativeobject,
>> > $EXCHANGE_MAILSTORE)
>> >
>> >
>> > It fails with the '(' part, and I am certainly not sure what is the
>> > 'http://...'part,
>> >
>> >
>> > any idea?
>> >
>> >
>> > thanks
>> >
>> >
>> > "Marco Shaw" wrote:
>> >
>> >> Tzachi wrote:
>> >> > thanks in advence
>> >> > Tzachi
>> >>
>> >> Google is your friend...
>> >>
>> >> http://www.developer.com/net/net/article.php/3690276
>> >>
>> >> Marco
>> >>
>> >> --
>> >> ----------------
>> >> PowerGadgets MVP
>> >> http://www.powergadgets.com/mvp
>> >>
>> >> Blog:
>> >> http://marcoshaw.blogspot


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Determine Mailbox under Storage Group in Exchange Server 2003 VB Script
Exchange 2003 Mailbox Store defaults via VBScript VB Script
Set-mailbox like powershell cmdlets with the Exchange 2003 Server PowerShell
"unknow exception" when trying to create exchange 2003 mailbox. VB Script
Can Powershell return Exchange mailbox info? PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46