Create a New-LocalUser - Problems.


im writing command line create new local user account, isn't working.

new-localuser -name blc -password blc004 -accountneverexpires -fullname blc -passwordneverexpires -usermaynotchangepassword

after command line , can see message:

new-localuser : cannot bind parameter 'password'. cannot convert "blc004" value of type "system.string" type
"system.security.securestring".
@ line:1 char:35
+ new-localuser -name blc -password blc004 -accountneverexpires -fullna ...
+                                   ~~~~~~
    + categoryinfo          : invalidargument: (:) [new-localuser], parameterbindingexception
    + fullyqualifiederrorid : cannotconvertargumentnomessage,microsoft.powershell.commands.newlocalusercommand

i tried change password, appear samething. knows can work ?


hi,

sure, cmdlt can't accept password without security...

ps c:\> $password = read-host -assecurestring ps c:\> new-localuser "user03" -password $password -fullname "third user" -description "description of account." name enabled description ---- ------- ----------- user03 true description of account.

you can find documentation here

https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.localaccounts/new-localuser


merci de marquer comme réponse les sujets qui vous ont permis d'avancer afin que cela puisse être bénéfique aux personnes qui rencontrent le même problème.



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x800f080c - Feature name NetFX3 is unknown

Checkedlist box

schannel