blister911
MIS
I'm looking to pass a parameter into the New-Mailbox cmdlet, but it won't accept it.
Basically what I'm doing is trying to do is create a resource or shared mailbox based on user input. I get all the information but I can't seem to get the command to accept the type of mailbox (-room, -equipment, -shared). If I hard-code the parameters it works, but then I have to have 3 blocks of almost identical code. (We change some other mailbox settings, too)
(Not actual code)
$mbox = "Conference_Room"
$mbox_upn = "Conference_Room@mydomain.com"
$grp_ou = "mydomain.com/Resources"
#Display
1. Room
2. Equipment
3. Shared Mailbox
$resource_type = read-host "Enter type of mailbox to create."
switch ($resource_type)
{
0{$null}
1{$resource = "-room"}
2{$resource = "-equipment"}
3{$resource = "-shared"}
}
New-Mailbox -Name $mbox -Alias $mbox -OrganizationalUnit $grp_ou -UserPrincipalName $mbox_upn -SamAccountName $mbox-Database $dbase_name $resource
This seems like it should be easy to do, but I can't seem to make it work.
Thanks.
Light travels faster than sound. That's why some people appear bright until you hear them speak.
Basically what I'm doing is trying to do is create a resource or shared mailbox based on user input. I get all the information but I can't seem to get the command to accept the type of mailbox (-room, -equipment, -shared). If I hard-code the parameters it works, but then I have to have 3 blocks of almost identical code. (We change some other mailbox settings, too)
(Not actual code)
$mbox = "Conference_Room"
$mbox_upn = "Conference_Room@mydomain.com"
$grp_ou = "mydomain.com/Resources"
#Display
1. Room
2. Equipment
3. Shared Mailbox
$resource_type = read-host "Enter type of mailbox to create."
switch ($resource_type)
{
0{$null}
1{$resource = "-room"}
2{$resource = "-equipment"}
3{$resource = "-shared"}
}
New-Mailbox -Name $mbox -Alias $mbox -OrganizationalUnit $grp_ou -UserPrincipalName $mbox_upn -SamAccountName $mbox-Database $dbase_name $resource
This seems like it should be easy to do, but I can't seem to make it work.
Thanks.
Light travels faster than sound. That's why some people appear bright until you hear them speak.