I type this Powershell command
PS C:\Users\User> new-aduser -name "Tracy Jones" -givenname "Tracy" -surname "Jones" -samaccountname "tjones" userprincipalname "[email protected]" -path "ou=marketing,dc=abc,dc=com" -accountpassword(-Read-Host -assecurestring "type password for user") -enables $true
It shows me this kind of error message:
-Read-Host : The term '-Read-Host' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:184
... path "ou=marketing,dc=abc,dc=com" -accountpassword(-Read-Host -assecu ...
~~~~~~~~~~
CategoryInfo : ObjectNotFound: (-Read-Host:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
You can try this:
Read-Host
in separate variable and statement.Enables
corrected toEnabled