Concat two strings in powershell and supply as one parameter

Viewed 50975

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 '+'."

1 Answers
Related