I am trying to concatinate two strings into a variable and then supple the new variable as a parameter in a command
$firstName = Read-Host -Prompt 'enter user first name'
$lastName = Read-Host -Prompt 'enter user last name'
$userAblevetsEmail = '' + $firstName + '.' + $lastName + '@company.com'
New-MsolUser -UserPrincipalName $userAblevetsEmail -DisplayName $firstName + " " + $lastName -FirstName $firstName
I get the following error:
"New-MsolUser : A positional parameter cannot be found that accepts argument '+'."
$userAblevetsEmail = "{0}.{1}@company.com" -f $firstName, $lastName