Rename LocalGroup - PowerShell
Overview
Rename-LocalGroup renames local groups on the computer. It allows you to modify the names of existing groups, making it useful for organizing and managing user accounts and permissions.
Syntax
Rename-LocalGroup [-Identity] <GroupIdentity> -NewName <NewName> [ [-NewDescription] <String> ] [<CommonParameters>]
Options/Flags
- -Identity (-Id): Specifies the name or security identifier (SID) of the group to be renamed.
- -NewName: Specifies the new name for the group.
- -NewDescription: Specifies a new description for the group.
Examples
- Rename a local group:
Rename-LocalGroup -Identity 'MyGroup' -NewName 'NewGroupName'
- Rename a group and update its description:
Rename-LocalGroup -Identity 'MyGroup' -NewName 'NewGroupName' -NewDescription 'Updated Group Description'
Common Issues
- Access denied: Verify that you have sufficient permissions to modify the local group.
- Group not found: Ensure that the specified group exists and its name or SID matches the
-Identity
parameter.
Integration
Rename-LocalGroup can be used in conjunction with other PowerShell commands for advanced tasks:
- Get-LocalGroup: Retrieve information about local groups before or after renaming.
- New-LocalGroup: Create new local groups after renaming existing ones.
- Add-LocalGroupMember: Add users or groups to a renamed group.