Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Exchange 2007 Bulk Mailbox Creation - Password?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 09-27-2007   #1 (permalink)
John W
Guest


 

Exchange 2007 Bulk Mailbox Creation - Password?

I have been looking at the commands, and i've got one ready to import users
and create mailboxes in exchange 2007 from a csv file with the following
command:

Import-CSV import.csv | foreach {new-mailbox -alias $_.alias -name
$_.name -userPrincipalName $_.UPN -database $_.Database -org
script -Password $_.Password}



The only problem is I get an error because Password cannot be plain text, it
must be a secure string. How can I change this command so that it reads the
value from the CSV file and converts it to a secure string before passing it
to the account creation part?







My System SpecsSystem Spec
Old 09-27-2007   #2 (permalink)
RichS
Guest


 

RE: Exchange 2007 Bulk Mailbox Creation - Password?

Try

Import-CSV import.csv | foreach {$pswd = ConvertTo-SecureString $_.Password;
new-mailbox -alias $_.alias -name
$_.name -userPrincipalName $_.UPN -database $_.Database -org
script -Password $pswd}

--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"John W" wrote:
Quote:

> I have been looking at the commands, and i've got one ready to import users
> and create mailboxes in exchange 2007 from a csv file with the following
> command:
>
> Import-CSV import.csv | foreach {new-mailbox -alias $_.alias -name
> $_.name -userPrincipalName $_.UPN -database $_.Database -org
> script -Password $_.Password}
>
>
>
> The only problem is I get an error because Password cannot be plain text, it
> must be a secure string. How can I change this command so that it reads the
> value from the CSV file and converts it to a secure string before passing it
> to the account creation part?
>
>
>
>
>
>
>
My System SpecsSystem Spec
Old 09-27-2007   #3 (permalink)
John W
Guest


 

Re: Exchange 2007 Bulk Mailbox Creation - Password?

Thanks. That didn't work, it was giving me an error but set me on the right
track! i had to add the -asplaintext -force on to the end of that
converttosecurestring command. For anyone else with this problem, here's
what my final command looks like:

import-csv import.csv | foreach {$pswd = ConvertTo-SecureString $_.Pass
word -asplaintext -force; new-mailbox -alias $_.alias -name
$_.name -userprincip
alname $_.upn -database $_.database -org script -Password $pswd -displayname
$_.
name -firstname $_.firstname -lastname $_.lastname -samaccountname
$_.samaccount
name}

This will import/create mailboxes from a csv file with those headings (ie:
$_.Password would be the heading of "Password" in the csv file)



"RichS" <RichS@xxxxxx> wrote in message
news:684439F6-8C26-46B6-84E4-A40761A0D0C8@xxxxxx
Quote:

> Try
>
> Import-CSV import.csv | foreach {$pswd = ConvertTo-SecureString
> $_.Password;
> new-mailbox -alias $_.alias -name
> $_.name -userPrincipalName $_.UPN -database $_.Database -org
> script -Password $pswd}
>
> --
> Richard Siddaway
> Please note that all scripts are supplied "as is" and with no warranty
> Blog: http://richardsiddaway.spaces.live.com/
> PowerShell User Group: http://www.get-psuguk.org.uk
>
>
> "John W" wrote:
>
Quote:

>> I have been looking at the commands, and i've got one ready to import
>> users
>> and create mailboxes in exchange 2007 from a csv file with the following
>> command:
>>
>> Import-CSV import.csv | foreach {new-mailbox -alias $_.alias -name
>> $_.name -userPrincipalName $_.UPN -database $_.Database -org
>> script -Password $_.Password}
>>
>>
>>
>> The only problem is I get an error because Password cannot be plain text,
>> it
>> must be a secure string. How can I change this command so that it reads
>> the
>> value from the CSV file and converts it to a secure string before passing
>> it
>> to the account creation part?
>>
>>
>>
>>
>>
>>
>>

My System SpecsSystem Spec
Old 09-27-2007   #4 (permalink)
John W
Guest


 

Re: Exchange 2007 Bulk Mailbox Creation - Password?

I do have a question though. now that I have this command:


import-csv import.csv | foreach {$pswd = ConvertTo-SecureString $_.Pass
word -asplaintext -force; new-mailbox -alias $_.alias -name
$_.name -userprincip
alname $_.upn -database $_.database -org script -Password $pswd -displayname
$_.
name -firstname $_.firstname -lastname $_.lastname -samaccountname
$_.samaccount
name}



How is it that I can save it as a file and execute it without having to type
that thing in the command shell everytime? I thought i just save it as ps1
file but powershell tells me it's not a recognized cmdlet or something.

"John W" <whitesj@xxxxxx> wrote in message
news:e2x9dFUAIHA.5360@xxxxxx
Quote:

> Thanks. That didn't work, it was giving me an error but set me on the
> right track! i had to add the -asplaintext -force on to the end of that
> converttosecurestring command. For anyone else with this problem, here's
> what my final command looks like:
>
> import-csv import.csv | foreach {$pswd = ConvertTo-SecureString $_.Pass
> word -asplaintext -force; new-mailbox -alias $_.alias -name
> $_.name -userprincip
> alname $_.upn -database $_.database -org script -Password
> $pswd -displayname $_.
> name -firstname $_.firstname -lastname $_.lastname -samaccountname
> $_.samaccount
> name}
>
> This will import/create mailboxes from a csv file with those headings (ie:
> $_.Password would be the heading of "Password" in the csv file)
>
>
>
> "RichS" <RichS@xxxxxx> wrote in message
> news:684439F6-8C26-46B6-84E4-A40761A0D0C8@xxxxxx
Quote:

>> Try
>>
>> Import-CSV import.csv | foreach {$pswd = ConvertTo-SecureString
>> $_.Password;
>> new-mailbox -alias $_.alias -name
>> $_.name -userPrincipalName $_.UPN -database $_.Database -org
>> script -Password $pswd}
>>
>> --
>> Richard Siddaway
>> Please note that all scripts are supplied "as is" and with no warranty
>> Blog: http://richardsiddaway.spaces.live.com/
>> PowerShell User Group: http://www.get-psuguk.org.uk
>>
>>
>> "John W" wrote:
>>
Quote:

>>> I have been looking at the commands, and i've got one ready to import
>>> users
>>> and create mailboxes in exchange 2007 from a csv file with the following
>>> command:
>>>
>>> Import-CSV import.csv | foreach {new-mailbox -alias $_.alias -name
>>> $_.name -userPrincipalName $_.UPN -database $_.Database -org
>>> script -Password $_.Password}
>>>
>>>
>>>
>>> The only problem is I get an error because Password cannot be plain
>>> text, it
>>> must be a secure string. How can I change this command so that it reads
>>> the
>>> value from the CSV file and converts it to a secure string before
>>> passing it
>>> to the account creation part?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>
>

My System SpecsSystem Spec
Old 09-27-2007   #5 (permalink)
RichS
Guest


 

Re: Exchange 2007 Bulk Mailbox Creation - Password?

save it as a .ps1 file and you run it by either giving the full path or if
you are in directory containing the script you run it as
..\myscript.ps1

where myscript.ps1 is the name you saved it under

PowerShell does NOT have the current folder on the path so it can't find the
script if you just use the name
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"John W" wrote:
Quote:

> I do have a question though. now that I have this command:
>
>
> import-csv import.csv | foreach {$pswd = ConvertTo-SecureString $_.Pass
> word -asplaintext -force; new-mailbox -alias $_.alias -name
> $_.name -userprincip
> alname $_.upn -database $_.database -org script -Password $pswd -displayname
> $_.
> name -firstname $_.firstname -lastname $_.lastname -samaccountname
> $_.samaccount
> name}
>
>
>
> How is it that I can save it as a file and execute it without having to type
> that thing in the command shell everytime? I thought i just save it as ps1
> file but powershell tells me it's not a recognized cmdlet or something.
>
> "John W" <whitesj@xxxxxx> wrote in message
> news:e2x9dFUAIHA.5360@xxxxxx
Quote:

> > Thanks. That didn't work, it was giving me an error but set me on the
> > right track! i had to add the -asplaintext -force on to the end of that
> > converttosecurestring command. For anyone else with this problem, here's
> > what my final command looks like:
> >
> > import-csv import.csv | foreach {$pswd = ConvertTo-SecureString $_.Pass
> > word -asplaintext -force; new-mailbox -alias $_.alias -name
> > $_.name -userprincip
> > alname $_.upn -database $_.database -org script -Password
> > $pswd -displayname $_.
> > name -firstname $_.firstname -lastname $_.lastname -samaccountname
> > $_.samaccount
> > name}
> >
> > This will import/create mailboxes from a csv file with those headings (ie:
> > $_.Password would be the heading of "Password" in the csv file)
> >
> >
> >
> > "RichS" <RichS@xxxxxx> wrote in message
> > news:684439F6-8C26-46B6-84E4-A40761A0D0C8@xxxxxx
Quote:

> >> Try
> >>
> >> Import-CSV import.csv | foreach {$pswd = ConvertTo-SecureString
> >> $_.Password;
> >> new-mailbox -alias $_.alias -name
> >> $_.name -userPrincipalName $_.UPN -database $_.Database -org
> >> script -Password $pswd}
> >>
> >> --
> >> Richard Siddaway
> >> Please note that all scripts are supplied "as is" and with no warranty
> >> Blog: http://richardsiddaway.spaces.live.com/
> >> PowerShell User Group: http://www.get-psuguk.org.uk
> >>
> >>
> >> "John W" wrote:
> >>
> >>> I have been looking at the commands, and i've got one ready to import
> >>> users
> >>> and create mailboxes in exchange 2007 from a csv file with the following
> >>> command:
> >>>
> >>> Import-CSV import.csv | foreach {new-mailbox -alias $_.alias -name
> >>> $_.name -userPrincipalName $_.UPN -database $_.Database -org
> >>> script -Password $_.Password}
> >>>
> >>>
> >>>
> >>> The only problem is I get an error because Password cannot be plain
> >>> text, it
> >>> must be a secure string. How can I change this command so that it reads
> >>> the
> >>> value from the CSV file and converts it to a secure string before
> >>> passing it
> >>> to the account creation part?
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> >
>
>
>
My System SpecsSystem Spec
Closed Thread
Update your Vista Drivers Update Your Drivers Now!!

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Exchange 2007 Remove Mailbox after AD deletion Shelley .NET General 0 07-25-2008 01:20 PM
Exchange 2007 - Mailbox management Sabo, Eric PowerShell 14 02-11-2008 10:01 AM
Re: Exchange 2007: cross org mailbox migration bulk from csv file selspiero PowerShell 9 01-10-2008 10:41 AM
Exchange 2007: cross org mailbox migration bulk from csv file selspiero PowerShell 8 01-09-2008 08:25 AM
Creating a new mailbox on Exchange 2007 huzaifa kagazwala PowerShell 5 12-04-2006 10:26 AM


Vistax64.com 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 2005-2008

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 47 48 49 50 51