Purpose: Add a user account to a local group on a Windows computer.
Run the following Add-LocalGroupMember command in a PowerShell window using an account with local administrator privileges:
Add-LocalGroupMember -Group "<local-group>" -Member "<user1>", "<domain\user2>", "<MicrosoftAccount\[email protected]>", "<AzureAD\[email protected]>", ...Notes:<local-group> : Local group to add user account to<user1> : Local user account to be added to <local-group><domain\user2> : Domain user account to be added to <local-group><MicrosoftAccount\[email protected]> : Microsoft user account to be added to <local-group><AzureAD\[email protected]> : Azure AD / Microsoft 365 user account to be added to <local-group>
References:
Add-LocalGroupMember (Microsoft.PowerShell.LocalAccounts) – PowerShell | Microsoft Docs
Related:
Command Prompt: Add Local User Account To Local Group – CodeCentral.com
PowerShell: Delete/Remove A Local User Account – CodeCentral.com
