Windows – Find built-in administrator account name and disable it

By Saad Khamis

December 14, 2022

41538 views

Introduction

We will find the built-in administrator account name, even if it was renamed, and disable it.

When Windows workstation or server is installed, the default built-in administrator account name is Administrator. Some companies rename the local built-in administrator account, as a result, instead of using the default account name, we will use the account well-known security identifier (SID). The account SID has the following format “S-1-5-domain-500″.

Commands used

Disable-LocalUserDisables a local user account.
Get-LocalUserGets local user accounts.
Get-WmiObjectGets instances of Windows Management Instrumentation (WMI) classes or information about the available classes.

Find built-in local administrator account name

Use the following command to find the account on the local system.

Find built-in local administrator account name on remote system

For a remote system or even a local system, we can use Get-WmiObject.

With PowerShell splatting:

Find built-in local administrator account name on multiple systems

Disable built-in local administrator account

To disable the account, use Disable-LocalUser.

In conclusion

In summary, we explored how to get the name of the built-in administrator account name, even if it was renamed, on a single or multiple systems. Also, how to disable the account.

Did you find this code easy to follow and helpful to you? I certainly would love to hear your feedback and suggestions. So, let me know in the comments below. Happy PowerShelling.

Disclaimer

Purpose of the code contained in blog is solely for learning and demo purposes. Author will not be held responsible for any failure or damages caused due to any other usage.

Comments

There's no comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

List all AWS Certificate Manager certificates

By Saad Khamis 14108 views July 31, 2024

Get all AWS EBS snapshots across all profiles and regions

By Saad Khamis 18466 views June 26, 2024