Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Managing Local Users and Groups in Windows using lusrmgr.msc

Managing Local Users and Groups with lusrmgr.msc in Windows: Examples in PowerShell and Batch Scripts

In the Windows operating system, managing local users and groups is a crucial task for system administrators. It allows them to control access to resources, assign permissions, and ensure the security of the system. The lusrmgr.msc tool is a powerful graphical user interface (GUI) provided by Windows that simplifies the management of local users and groups. This article aims to provide an instructive guide on how to effectively utilize lusrmgr.msc, along with examples in PowerShell and Batch Scripts, to manage local users and groups in a Windows environment.

Examples:

  1. Creating a Local User Account: To create a local user account using lusrmgr.msc, follow these steps:
    • Open the Run dialog box by pressing Windows + R.
    • Type "lusrmgr.msc" and press Enter.
    • In the Local Users and Groups window, right-click on "Users" and select "New User."
    • Fill in the necessary details for the new user account, such as username, full name, and password.
    • Click on "Create" to create the user account.

PowerShell Script:

$Username = "NewUser"
$Password = ConvertTo-SecureString "Password123" -AsPlainText -Force
$UserAccount = New-LocalUser -Name $Username -Password $Password -FullName "New User" -Description "Example user account"

Batch Script:

net user NewUser Password123 /add /fullname:"New User" /comment:"Example user account"

  1. Adding a Local User to a Group: To add a local user to a group using lusrmgr.msc, follow these steps:
    • Open the Run dialog box by pressing Windows + R.
    • Type "lusrmgr.msc" and press Enter.
    • In the Local Users and Groups window, double-click on "Groups."
    • Right-click on the desired group and select "Add to Group."
    • Click on "Add" and enter the username of the user you want to add to the group.
    • Click on "Check Names" to validate the username and then click on "OK" to add the user to the group.

PowerShell Script:

$Username = "ExistingUser"
$GroupName = "Administrators"
Add-LocalGroupMember -Group $GroupName -Member $Username

Batch Script:

net localgroup Administrators ExistingUser /add

In case the topic is not applicable to the Windows environment, an explanation of the alternative or equivalent methods available in that environment should be provided.

To share Download PDF

Windows lusrmgr.msc PowerShell Batch Script User Account Management Group Management

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.