@wrx7m said in PowerShell - Create New AD User Using Prompts and Variables:
If I get rid of the attempt to combine the 2 existing variables into a 3rd, I get this error.
New-ADUser : A positional parameter cannot be found that accepts argument '+'. At \\FP02\it\Scripts\AD\AD-InitialUserCreationVariables.ps1:5 char:1 + New-ADUser -Name "$GivenName $Surname" ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [New-ADUser], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ActiveDirectory.Management.Commands.NewADUser
Like this I think:
New-ADUser -Name "$($GivenName) $($Surname)"`From: https://blogs.technet.microsoft.com/stefan_stranger/2013/09/25/powershell-sub-expressions/