- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a new local group using PowerShell?
To create a new local group on the local or the remote system using PowerShell, we can use the NewLocalGroup command.
Example
New-LocalGroup -Name "TestGroup" -Description "Test Group"
Output
Name Description ---- ----------- TestGroup Test Group
You can verify it from the Computer Management GUI.
To create the local group on the remote systems, you can use Invoke-Command. For example,
Invoke-Command -ComputerName Test1-Win2k12,Test1-Win2k16 -ScriptBlock{ New-LocalGroup -Name 'TestGroup' -Description 'New Test Group' }
The above command will create a New Local group named ‘TestGroup’ on the remote systems, Test1-Win2k12, and Test1-Win2k16.
New-LocalGroup command is available in the module Microsoft.PowerShell.LocalAccounts which is part of the PowerShell version 5.1 or higher versions. If you have the older PowerShell version system then you can use the cmd command.
Net localgroup 'TestGroup2' /add
For the remote servers,
Invoke-Command -ComputerName Test1-Win2k12, Test1-Win2k16 -ScriptBlock{ Net Localgroup ‘TestGroup2’ /add }
- Related Articles
- How to create a new local user in windows using PowerShell?
- How to create a new Azure resource group using PowerShell?
- How to remove a member from the local group using PowerShell?
- How to get the local Administrators group members using PowerShell?
- How to add the user to the local Administrators group using PowerShell?
- How to delete the local group from the windows system using PowerShell?
- How to create new alias with PowerShell?
- How to change the local disk name using PowerShell?
- How to get the list of local groups using PowerShell?
- How to change the local user account password using PowerShell?
- How to set the local user account settings using PowerShell?
- How to find the locked local user accounts using PowerShell?
- How to get the disabled local user accounts using PowerShell?
- How to create a temporary file using PowerShell?
- How to delete the Azure Resource Group using PowerShell?

Advertisements