Mark Minasi's Reader Forum
Mark Minasi's Reader Forum
Home | Profile | Register | Active Topics | Active Polls | Members | Search | FAQ | Minasi Forum RSS Feed
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 HALP! Questions on Windows and Windows Server
 PowerShell
 Shared Mailbox Creation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

JSCLMEDAVE
Administrator

USA
6116 Posts
Status: online

Posted - 07/02/2012 :  3:48:25 PM  Show Profile  Visit JSCLMEDAVE's Homepage  Click to see JSCLMEDAVE's MSN Messenger address  Reply with Quote
I would like to set up a quick and easy script for creating a Shared Mailbox.

I am using ISE since it will provide the pop-up boxes for the Admins that are not familiar with Powershell.


$FullName = Read-Host "What is the Display Name for the Mailbox?"
$Email = Read-Host "What is the Email Address? Name@Company.com"
$UPN = Read-Host "User Principal Name Name@Corp.Company.ad"

New-Mailbox -Name $FullName -Alias $FullName -Shared -OrganizationalUnit 'corp.vha.ad/Users' -PrimarySmtpAddress $Email -RetentionPolicy 'Default Retention Policy' -UserPrincipalName $UPN -SamAccountName $FullName -FirstName $FullName -Database 'DB2' -whatif


$UPN,,, I would like to be able to just type the UserID here rather than the full UserID@Corp.Company.ad

So something like -UserPrincipalName $UPN@Corp.Company.ad

Is there a way to append $UPN to @Corp.Company.ad ??

We have multiple email addresses in use to that is not a static answer.

Tim-

“This too shall pass"

Jazzy
Administrator

Netherlands
1932 Posts
Status: offline

Posted - 07/02/2012 :  4:49:52 PM  Show Profile  Visit Jazzy's Homepage  Click to see Jazzy's MSN Messenger address  Reply with Quote
No problem, you can concatenate two strings: http://www.vistax64.com/powershell/225548-concatenate-text-string-text-variable-no-space-between.html

Jetze Mellema

Exchange specialist
Former MVP (2005-2012)
My blog: http://jetzemellema.blogspot.com (Dutch)
My company: http://www.imara-ict.nl/
Go to Top of Page

JSCLMEDAVE
Administrator

USA
6116 Posts
Status: online

Posted - 07/02/2012 :  4:55:26 PM  Show Profile  Visit JSCLMEDAVE's Homepage  Click to see JSCLMEDAVE's MSN Messenger address  Reply with Quote
Thanks Jetze

Claus sorted it out for me. Simple double quote is all I was missing. I am working on creating a GUI for it now.


$UPN = Read-Host "User Principal Name"
New-Mailbox -Name $FullName -Alias $FullName -Shared -OrganizationalUnit 'Corp.Company.AD/Users' -PrimarySmtpAddress $Email -RetentionPolicy 'Default Retention Policy' -UserPrincipalName "$UPN@corp.company.ad" -SamAccountName $FullName -FirstName $FullName -Database 'DB2' -whatif




Tim-

“This too shall pass"
Go to Top of Page

JSCLMEDAVE
Administrator

USA
6116 Posts
Status: online

Posted - 07/02/2012 :  6:43:38 PM  Show Profile  Visit JSCLMEDAVE's Homepage  Click to see JSCLMEDAVE's MSN Messenger address  Reply with Quote
Claus just walked me through creating a GUI for this.

WOW!!!! I want Primal Scripts SOOOO BAD now! <g>

Tim-

“This too shall pass"
Go to Top of Page

Xenophane
Honorable But Hopeless Addict

Denmark
3070 Posts
Status: offline

Posted - 07/03/2012 :  02:40:48 AM  Show Profile  Visit Xenophane's Homepage  Send Xenophane an ICQ Message  Reply with Quote
The 2012 version of Primalscript has been rebranded to "Powershell Studio 2012", so remember to get that if you are going to get it..

Microsoft Powershell MVP

SIG> George Bernard Shaw : The power of accurate observation is commonly called cynicism by those who have not got it. </SIG>

You can read my blog at www.xipher.dk
Go to Top of Page

David_C
Welcome Newcomer

1 Posts
Status: offline

Posted - 07/05/2012 :  2:10:43 PM  Show Profile  Visit David_C's Homepage  Reply with Quote
Just a clarification:

PrimalForms was renamed to PowerShell Studio, not PrimalScript. PowerShell Studio is the product that allows you to create GUIs in PowerShell.

Thank you,

David
Go to Top of Page

Xenophane
Honorable But Hopeless Addict

Denmark
3070 Posts
Status: offline

Posted - 07/05/2012 :  2:53:34 PM  Show Profile  Visit Xenophane's Homepage  Send Xenophane an ICQ Message  Reply with Quote
Thank you for correcting me David, I don't know what I was thinking when I wrote it.

Microsoft Powershell MVP

SIG> George Bernard Shaw : The power of accurate observation is commonly called cynicism by those who have not got it. </SIG>

You can read my blog at www.xipher.dk
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Mark Minasi's Reader Forum © 2002-2011 Mark Minasi Go To Top Of Page
This page was generated in 0.12 seconds. Snitz Forums 2000