Most useful Powershell commands

A list of the most useful Powershell commands to keep close at reach.

Adding a local user to administrator group.

There may be times when you need to check who has administrative access on a PC or add/remove as appropriate.

The following Powershell command will list who is in the administrator group.

Get-LocalGroupMember -Group "Administrators"

The following Powershell command will add someone to the local admin group.

Add-LocalGroupMember -Group "Administrators" -Member ""

And the following command will remove someone from the local admin group.

Remove-LocalGroupMember -Group "Administrators" -Member ""