New-LocalUser - Problems. Does anyone knows whats is happening ?

42 views
Skip to first unread message

K800i2

unread,
Apr 5, 2017, 3:56:22 PM4/5/17
to
Im writing this command line to create a new local user account, but isn't working.






New-LocalUser -Name Blc -Password Blc004 -AccountNeverExpires -FullName Blc -PasswordNeverExpires -UserMayNotChangePassword





After this command line , i can see this message:





New-LocalUser : Cannot bind parameter 'Password'. Cannot convert the "Blc004" value of type "System.String" to type
"System.Security.SecureString".
At 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 to change the password, but appear the samething. Does somebody knows what can i do to work ?

MaxW

unread,
Apr 6, 2017, 1:20:02 PM4/6/17
to
Can't use plain text for the password parameter. Just convert it first to secure string, then run the cmdlet:

$i = ConvertTo-SecureString "Blc004" -AsPlainText -Force
New-LocalUser -Name blc -Password $i -AccountNeverExpires -FullName Blc -PasswordNeverExpires

Richard Mistrík

unread,
May 15, 2018, 7:53:50 AM5/15/18
to
Dňa streda, 5. apríla 2017 21:56:22 UTC+2 K800i2 napísal(-a):

Gloops

unread,
Jul 17, 2018, 5:44:40 PM7/17/18
to
Hello,

Does this help ?

https://msdn.microsoft.com/en-us/library/system.security.securestring(v=vs.110).aspx#vsString


--
Besoin d'un autre système, pas d'un autre gouvernement.
Reply all
Reply to author
Forward
0 new messages