PowerShell
Low risk
List local administrators on a Windows workstation
Displays local and domain accounts that are members of the position's Administrators group.
Get-LocalGroupMember -Group 'Administrateurs' -ErrorAction Stop |
Select-Object Name, ObjectClass, PrincipalSource |
Format-Table -AutoSize
When should you use it?
Use this in a privileged-account audit or before removing obsolete access.
What the script does
- Get-LocalGroupMember reads members of the local Administrators group.
- On a non-French Windows installation, adapt the local group name to the operating-system language.
Precautions
- Do not remove an account until you have identified its purpose and retained an emergency administrator account.
Rollback
This version of the script is read-only.