ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Managing Windows Local Groups with PowerShell

    Scheduled Pinned Locked Moved IT Discussion
    sam windows administration
    1 Posts 1 Posters 261 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      As with local users, we can manage local groups with PowerShell in a "PowerShell way" today. The commands for managing local users are part of the LocalAccounts commandlet, the same one that we use for managing local users.

      It is important to note that these commandlets are not part of PowerShell proper and are not available in all PowerShell versions. Also, while this is the "PowerShell way" to do user management, older methods like the net commands are stand alone utilities and work equally well from PowerShell as from any other calling method.

      List Local Groups

      Get-LocalGroup
      

      Get Details of Specific Local Group

      Get-LocalGroupMember -Name administrators
      

      Add Local User to a Local Group

      Add-LocalGroupMember -Group administrators -Member sally 
      

      or you can have a comma delimited list of users...

      Add-LocalGroupMember -Group administrators -Member sally, john, buck, mack, hank, betty
      

      Add an Active Directory Domain User to a Local Group

      Add-LocalGroupMember -Group administrators -Member "mydomain\roberta" 
      

      Create a New Local Group

      New-LocalGroup -Name mynewgroup 
      

      Delete a Local Group

      Remove-LocalGroup -Name mynewgroup 
      

      Rename a Local Group

      Rename-LocalGroup -Name mynewgroup -NewName myrenamedgroup
      

      Part of a series on Windows Systems Administration by Scott Alan Miller

      1 Reply Last reply Reply Quote 1
      • 1 / 1
      • First post
        Last post