Course Overview

/

Creating Local User

Creating Local User

There will be many situations where there is a need to create a new user on a system, whether that is for general administration or for creating persistent access on a target host.

Just as another reminder that PowerShell is a scripting language, and we can utilise this to create a user securely. Our first step is to define a variable and make sure the user input is secured as a secure string, see below:

· $Password = Read-Host -AsSecureString

Once the user has entered the password and pressed Enter the variable will store their newly created password.

We can then use the variable as the password open when create the full user account, like so:

· New-LocalUser "Adam" -Password $Password -FullName "Adam Higgins" -Description "IT Support"

Now we have created the user, we may need to add them to a group, in the below example we have added Adam to the local Admins group.

· Add-LocalGroupMember -Group "Administrators" -Member "Adam"