- 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 delete the local group from the windows system using PowerShell?
To delete the local group from the windows system using PowerShell, you need to use the RemoveLocalGroup command as shown below.
Remove-LocalGroup -Name TestGroup
In the above example, the local group name TestGroup will be removed from the local system. To remove the local group from the remote systems, we can use Invoke-Command as shown in the below example.
Invoke-Command -ComputerName Test1-Win2k12,Test1-Win2k16 -ScriptBlock {Remove-LocalGroup -Name TestGroup}
Remove-Localgroup command is supported from the PowerShell version 5.1 onwards and this command is a part of Microsoft.PowerShell.LocalAccounts module. If you have the PS version 5.1 or the local accounts module not available then you can use the cmd command.
net localgroup testgroup /delete
Similarly, you can run the above command on the remote system using Invoke-Command method.
Invoke-Command -ComputerName Test1-Win2k12,Test1-Win2k16 -ScriptBlock{ net localgroup TestGroup /delete }
- Related Articles
- How to delete the windows certificate using PowerShell?
- How to remove a member from the local group using PowerShell?
- How to add users and groups to the local groups on Windows System using PowerShell?
- How to get the local Administrators group members using PowerShell?
- How to delete the Azure Resource Group using PowerShell?
- How to add the user to the local Administrators group using PowerShell?
- How to create a new local group using PowerShell?
- How to block ports on the Windows Operating System using PowerShell?
- How to create a new local user in windows using PowerShell?
- How to open a port in the Windows Operating System using PowerShell?
- How to enable or disable local user on Windows OS using PowerShell?
- How to delete the specific node from the XML file using PowerShell?
- How to eject the USB device from the system using PowerShell?
- How to get the azure resources from the resource group using PowerShell?
- How to change the local disk name using PowerShell?

Advertisements