Home ยป PowerShell ยป How to Delete a Local User Account Using PowerShell

How to Delete a Local User Account Using PowerShell

To remove a local user account in PowerShell, use the `Remove-LocalUser` command. This command deletes local user accounts.

Here, is the PowerShell code to delete a local user account.

Remove-LocalUser [-Name] <String[]> [-SID] <SecurityIdentifier[]>  [-InputObject] <LocalUser[]>

In this article, we will discuss how to delete a local user account using the PowerShell Remove-LocalUser command.

Remove a Local User Account Using PowerShell

To remove a local user account in PowerShell, use the Remove-LocalUser cmdlet with the Name parameter to specify the local user account name,

Remove-LocalUser -Name "AdminTestUser1"

In the above PowerShell script, the Remove-LocalUser cmdlet deletes the local user account name specified by the Name parameter โ€œAdminTestUser1โ€œ.

Conclusion

I hope the above article on how to use the Remove-LocalUser command in PowerShell to delete a local user account is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Related Links

Microsoft.PowerShell.LocalAccounts Module

Add-LocalGroupMember

Get-LocalUser

Get-LocalGroupMember

New-LocalUser

Enable-LocalUser

Rename-LocalUser

Set-LocalUser

Disable-LocalUser

Remove User from Local Group using Command Prompt