Why is important to know who has admin rights?

Imagine you are the attacker and you have admin rights on a system. Oh Goodness!

As an attacker, knowing which users have administrative privileges on a system can be useful because these users often have more access to sensitive resources and functions. For example, an attacker who is able to compromise the account of a user with administrative privileges may be able to escalate their privileges and gain access to restricted parts of the system.

As a defender, knowing which users have administrative privileges on a system is important because it allows you to monitor and protect these accounts more carefully. For example, you may want to implement additional security measures (such as two-factor authentication) for administrative accounts, or you may want to regularly review the list of users with administrative privileges to ensure that only trusted individuals have access to these accounts.

Checking which users have administrative privileges on a system is one way to harden the system against attacks. By limiting the number of users with administrative privileges, you can reduce the risk of an attacker being able to compromise an administrative account and escalate their privileges.

In addition, regularly reviewing the list of users with administrative privileges can help you ensure that only trusted individuals have access to these accounts. This can help prevent unauthorized users from gaining administrative access to the system.

Implementing additional security measures (such as two-factor authentication) for administrative accounts can also help harden the system against attacks. These measures can make it more difficult for an attacker to compromise an administrative account, even if they are able to obtain the username and password.

How to check who has admin rights with Powershell on Windows?

You can use the Get-LocalGroupMember cmdlet in PowerShell to list the members of a local group. For example, to list the members of the Administrators group, you can use the following command:

Get-LocalGroupMember -Group "Administrators"

This will display a list of all the users who are members of the Administrators group.

You can also use the Get-WmiObject cmdlet to list the members of a local group. Here is an example of how to use the cmdlet:

Get-WmiObject -Class Win32_GroupUser | Where-Object {$_.GroupComponent -match "Administrators"} | Select-Object -ExpandProperty PartComponent

This will display a list of all the users who are members of the Administrators group.

Any Way, This is all for now!

Peace!