Get-LocalGroupMembership

The Get-LocalGroupMembership function will query a single or multiple systems (to include remote) for a specified local group and its members. If members are a group (local or domain), the script will then begin to query all of those groups for members as well. To prevent the p

 
 
 
 
 
4.2 Star
(10)
10,094 times
Add to favorites
8/12/2013
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Flag for Disabled and Active Local Admin Accounts
    1 Posts | Last post April 29, 2018
    • this script show all the Local and domain admin account which have ever log in to a specific machine. But it does not show which Admin Accounts are currently Active only or defined on the machine itself. Is there any way to figuer out?
      
      I ran 'Get-LocalUser' command on a test server and it show only realted info. i want the same outout quering a remote server. 
      
      Please shed some light
  • Get output for multiple servers?
    2 Posts | Last post January 29, 2018
    • Thank You for this script!!! My account validation job is lot easier because of this script.
      
      What should be the modification or addition to the script if I want to run this script against multiple remote servers? 
      
      For now I run this script against a single server(listed below), but to run against multiple servers will save time from merging all the output and i will have single Output file for all the servers. 
      
      Get-LocalGroupMembership -Computername ServerName -Group Administrators -Depth 5 | Format-Table > ServerNameLocalAdmin.txt
      
      Thank you!!!
      
      
      
    • I have another script that calls this one, requires a text file with the list of servers:
      
      Import-Module .\Get-LocalGroupMembership.ps1
      ForEach ($system in Get-Content "servers.txt")
      {
      Write-Host $system
      Get-LocalGroupMembership -ComputerName $system -Depth 1 | Format-Table -Autosize >> localadmins.txt
      }
  • Powershell script to export membership details from the local server group
    1 Posts | Last post November 24, 2017
    • Could someone please help with the powershell script to export membership details from the local server group  as WMI scripts makes the server performance very low.
      
      
  • cross-domain GroupMembership
    2 Posts | Last post September 28, 2017
    • Thank you very much for this magnificant script.
      
      For some reason a customer is a big fan of cross domain membership.
      When I use Get-LocalGroupMembership.ps1 cross domain membership is not shown.
      Is it possible to make the script support cross-domain membership?
      Best regards
      Carsten
    • same here! 
      If somebody could modify the script in order to support cross-domains, this would be very helpful!
  • Differences when running on 2008R2 and 2012R2
    1 Posts | Last post July 07, 2017
    • Hi - I get a different order of 'columns' depending on whether I run the script on 2008R2 (column order Name / ParentGroup / isGroup / Type / Computername / Depth) or on 2012R2 (column order Name / Depth / ParentGroup / Type / Computername / isGroup) - anyone know why, or if it's possible to get the same output on both O/Ses?
      
      Thanks
      Tim
      
      
  • Script Execution
    4 Posts | Last post November 24, 2016
    • Hi Boe..
      
      When I execute the script it just returns to a blank line.  What am I missing here?
      
      PS C:\Scripts\PowerShell_ActiveDirectory> .\Get-LocalGroupMembership -Group 'Administrators' -Depth 1
      
      PS C:\Scripts\PowerShell_ActiveDirectory> .\Get-LocalGroupMembership -Computername loki -Group 'Administrators' -Depth 1 | Format-
      Table –AutoSize
      
      Thank you in advance..
      
    • me too
    • Import the module first, then run the commands without the '.\' at the beginning?
    • Hi!
      
      Sorry, but I have the same problem and when I execute the script it just returns to a blank line! What is the PS module I have to import?
      
      Regards!
  • whenChanged and whenCreated?
    1 Posts | Last post September 19, 2016
    • Hi Folks, is there a way to also pull user properties such as whenCreated and whenChanged using this already awesome script? 
  • Table format truncates names
    2 Posts | Last post August 16, 2016
    • Hi - great script! However... if I output in table format, any user / group names longer that 16 characters get truncated to 16 characters plus '...'.  How can I make this 'column' wider?
      
      Thanks in advance
    • Duh.... -Autosize is the option, ie:
      Get-LocalGroupMembership -Group Administrators -Depth 1 | Format-Table -Autosize
  • Issues with PowerShell 5?
    2 Posts | Last post April 25, 2016
    • This is a great script though I'm running into this error on some servers.
      
          WARNING: GLGMError while invoking GetType. Could not find member.
      
      Googling the error mentions that the error is a PowerShell 5 issue. There is a workaround but I'm struggling with how to apply it to your script.
      http://stackoverflow.com/questions/31949541/print-local-group-members-in-powershell-5-0
    • Same here,I you end up fixing this, please share the solution here so everyone can solve the issue.
  • trying to get account status (enabled/disabled)
    1 Posts | Last post August 04, 2015
    • Hi Boe
      
      Thanks for this great script!  I am trying to see if I can add account enabled/disabled status to the output, but I'm getting lost.  Get-Member on your $LocalGroup variable told me that there were properties available for Description, groupType, Name, and objectSID, which was encouraging.  However, GM for the one I need, $Member, just gives me System.__ComObject.
      
      Can the script be modified to include account status?
      
      thanks
      John
1 - 10 of 14 Items