Wednesday, February 18, 2026

Script to Add local user to Administrators

This is a script to add a user, create their password and add them to the local administrators group on a Windows computer. Everything with an * is a command line. I pushed this out with PDQ Deploy. This can be handy if you want to create a local admin user but not use the built in Windows administrator.

Items in red need changed to specific instance you want. These commands can be run in CMD.

To create the user

*net user /add username 

To change a local user’s password

*net user username password

To create a new local account

*net user username password /add

To add the new user to the local admin group

*net localgroup administrators username /add

To disable the built-in admin account

*net user administrator /active:no

To set account password to never expire

*WMIC USERACCOUNT WHERE Name="username" SET PasswordExpires=FALSE

No comments:

Post a Comment

Introduction

Introduction

I've worked in IT for many years at this point. I thought I would share some of the things I had learned. When I went to review my note...