This tutorial is based on PowerShell 5.1 and above, which is installed on Windows 10, Windows Server 2016 and higher by default. To use this command in earlier versions, you must add the linked module to PowerShell or use the commands Use Command Prompt to create an account.
First you should add local user to windows in powershell.
https://monovm.com/blog/create-local-user-with-powershell/
Add user to group in PowerShell
1. First, open the PowerShell Administrator.
2- Then Add-Local Group Member user command in groups, which, like other parsing commands, uses a specific and standard structure.
The Add-LocalGroupMember command structure
- Add-LocalGroupMember -Group [GroupName] -Member [UserNames]
As you can see in the above structure, adding a group and using the above command is very simple and theres no need for complex commands.
For a better understanding of this command, consider the following example.
Example of the command Add-LocalGroupMember
- Add-LocalGroupMember -Group Users -Member elizabet, Microsoft Account \ Elo@outlook.com, Mono\ lucy
In the above command, three users have been added to the Users group.
Note: You will be able to use a Microsoft account to add a domain or user account that has already been added to this system to a local group. Therefore, the use of the Add-LocalGroupMember command emphasizes the locality of the group and has the ability to add non-local users.
This way, you can use this command and the structure of the password commands to add and add multiple users to a group.
Note: This command has two main parameters mentioned in the example above and does not have any other parameters. Only standard PowerShell parameters like What if, Confirm etc. can be used at the end of the command.
You can access to PowerShell in Monovm Windows VPS server too, PowerShell provide more secure and smooth connection to your VPS server.
One OF my major goals is getting new experiences about ICT and what’s more making progress through this field.