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

Easily Discover a Local User\'s SID in Windows Using PowerShell

In the Windows environment, it is often necessary to work with security identifiers (SIDs) to manage user accounts and permissions. Knowing a user's SID can be useful for troubleshooting, scripting, or auditing purposes. This article will explain how to easily discover a local user's SID in Windows using PowerShell, providing practical examples and commands adapted for the Windows environment.

Examples:

  1. Using the Get-WmiObject Cmdlet:

    • Open PowerShell as an administrator.
    • Run the following command to retrieve the SID for a local user named "John":
      Get-WmiObject -Class Win32_UserAccount | Where-Object {$_.Name -eq "John"} | Select-Object SID
    • The output will display the SID associated with the "John" user.
  2. Using the Get-LocalUser Cmdlet (Windows 10 and newer):

    • Open PowerShell as an administrator.
    • Run the following command to retrieve the SID for a local user named "John":
      Get-LocalUser -Name "John" | Select-Object SID
    • The output will display the SID associated with the "John" user.
  3. Using the [System.Security.Principal.SecurityIdentifier] Class:

    • Open PowerShell as an administrator.
    • Run the following command to retrieve the SID for a local user named "John":
      $user = New-Object System.Security.Principal.NTAccount("John")
      $sid = $user.Translate([System.Security.Principal.SecurityIdentifier]).Value
      $sid
    • The output will display the SID associated with the "John" user.

To share Download PDF

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.