Can powershell be used to create local user accounts in windows?

I was able to create a local account in a remote machine through powershell terminal using the following code :

[ADSI]$server="WinNT://servername"

$HelpDesk=$server.Create("User","HelpDesk")

$HelpDesk.SetPassword("H3lpD3>K")

$HelpDesk.SetInfo()

This works fine.

I tried using New-LocalUser from powershell, but getting the following error : "The term 'New-LocalUser' is not recognized as the name of a cmdlet, function, script file, or operable program."

How to use powershell commands for local user account creation?

Answers


There is no "New-LocalUser" cmdlet. You can do it with code you have, by replacing 'servername' with 'localhost'.

[ADSI]$server="WinNT://localhost"

$HelpDesk=$server.Create("User","HelpDesk")

$HelpDesk.SetPassword("H3lpD3>K")

$HelpDesk.SetInfo()

Need Your Help

SoundCloud Stream_url doesnt work on Raspberry Pi

c# raspberry-pi soundcloud mediaelement

I have been discussing this topic on another forum and no one could actually help, let's see if someone here can.

Font Awesome icon inside text input element

html css fonts font-awesome

I am trying to insert a user icon inside username input field.