Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

how to wrap up New-aduser cmdlet

$
0
0

Hello

I've got this line in my script

new-aduser -name $cn -GivenName $firstname -Surname $lastName -UserPrincipalName $upn`
                                      -SamAccountName $sam -ProfilePath $profilePath`
                                      -AccountPassword(ConvertTo-SecureString"$password" -AsPlainText -force)`

                                     -Enabled $True` followed by a few more attributes.

When all the attributes are in the same line with new-aduser cmdlet then there is no problem but if I try to make thenew-aduser and its parameters look like a paragraph using backticks ` (as shown above) then none of the attributes are recognized as the names of the cmdlet. At least that's the error it throws. Does anyone know how can I achieve this?

I just want my script to look nice.

Thank you


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>