Search code examples
powershelloffice365exchange-server

How to lowercase a variable expansion


I have the following code and variables declared. How do I make sure that $shared_mailbox_alias becomes lowercase when expanded to the Mailbox creation cmdlet below? Since it's based on $Project_code which is typed in capital letters:

$Project_number = Read-Host -Prompt 'What is the Project Number ie. 02XXX'
$Project_code = Read-Host -Prompt 'What is the Project Code (in capital letters) ie. CRE'
$Project_name = Read-Host -Prompt 'What is the Project extended Name ie. Victoria Station Platform'

$shared_mailbox_displayname = "File: $Project_name"
$shared_mailbox_name = "$Project_code"
$shared_mailbox_alias = "file.$Project_code"

New-Mailbox -Shared -DisplayName $shared_mailbox_displayname -Name $shared_mailbox_name -Alias $shared_mailbox_alias -PrimarySmtpAddress $shared_mailbox_primarysmtp

My goal is to have an alias of "file.abc" rather than "file.ABC", and I cannot change the way it is been given as input (ABC) since I have other cmdlets that create folders with that syntax.

Cheers


Solution

  • Solved, thanks for the input, this is the syntax I used:

    $shared_mailbox_alias = "file.$($Project_code.ToLower())"