This article covers how to add users to local admin group either via Group Policy Objective or directly via command line.
To add a user to the local group in PowerShell:
You can add AD groups or users to the local admin group using the below Powershell command.
Add-LocalGroupMember -Group "Administrators" -Member "domain\user or group," "additional users or groups."
To add a user to the local admin group:
1. Right-click the newly created Group, select Properties, navigate to the Members tab, click Add… and enter designated users to the group, e.g. domain\administrator, domain\domain admins, domain\syskitmonitorservice.
2. Add other users that also need administrative privileges, if necessary.
3. Click OK to proceed.
To get local admin group members in PowerShell:
To get the local Administrators group members using PowerShell, you need to use the GetLocalGroupMember command.
This command is available in PowerShell version 5.1 onwards and the module for it is Microsoft. PowerShell. LocalAccounts.
To Create a User Account in Windows 10 with PowerShell:
1. Open PowerShell as Administrator.
2. To create a new user account without a password, type New-LocalUser -Name "user_name" -Description "Description of your new account." -NoPassword .
3. To create a user account that has a password, firstly execute the following line: $Password = Read-Host -AsSecureString .