Exchange Mailbox and Powershell
I have a poweshell script that will create user mailboxes in Exchange 2007 and apply most of the information I'm looking for. Is it possible to add the Country/Region using powershell? I keep running across the set-qaduser, but I'm primarily using the
"New-Mailbox" and "Set-Mailbox" commands.
If the only way to add it is by the "set-qaduser", is there a plugin I need to add? I'm running the powershell script directly from the Exchange server.
Thank you
December 1st, 2010 9:53pm
Sorry, not sure how to answer your first question, but Set-QADUser is a Quest AD cmdlet (www.quest.com/powershell). You'll need to go to the download site to load the Quest product if you want to use Set-QADUser...
Free Windows Admin Tool Kit Click here and download it now
December 1st, 2010 10:39pm
Hi,
Just to add, the Quest Active Roles product is a free one. I use it myself and can recommend it, it gives some nice extra options that you didn't have in Exchange management shell.
/MartinExchange is a passion not just a collaboration software.
December 2nd, 2010 2:29am
There's no built-in cmdlet in Exchange to set the country attribute, you can use ADSI:
$exuser = get-user administrator
$aduser = [adsi]"LDAP://$($exuser.DistinguishedName)"
$aduser.InvokeSet('c','IL') # set country to Israel
$aduser.CommitChanges()Shay Levy [MVP]
PowerShay.com
PowerShell Toolbar
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2010 4:00am
On Thu, 2 Dec 2010 02:49:28 +0000, EJD21 wrote:
>
>
>I have a poweshell script that will create user mailboxes in Exchange 2007 and apply most of the information I'm looking for. Is it possible to add the Country/Region using powershell? I keep running across the set-qaduser, but I'm primarily using the
"New-Mailbox" and "Set-Mailbox" commands.
Set-User ... -CountryOrRegion <ISO Abbreviation>
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
December 2nd, 2010 11:09pm
On Thu, 2 Dec 2010 08:56:05 +0000, Shay Levi wrote:
>
>
>There's no built-in cmdlet in Exchange to set the country attribute, you can use ADSI:
>
>$exuser = get-user administrator $aduser = [adsi]"LDAP://$($exuser.DistinguishedName)" $aduser.InvokeSet('c','IL') # set country to Israel $aduser.CommitChanges()
Wouldn't "set-user .... -countryorregion IL" be better? Setting only
the "c" property doesn't set the corresponding 'co' and 'countryCode'
properties to agree with the 'c' property. That can lead to some
interesting problems. :-)
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2010 11:13pm
You're absolutely right. Funny I thought I used that parameter when I tested it, I guess I was wrong!Shay Levy [MVP]
PowerShay.com
PowerShell Toolbar
December 4th, 2010 2:08pm