Query members of Local Administrators group in all Domain Computers

Thank you everyone for you download and support! Your support was the main motivation for me to enhance this function. Please make sure to vote my script, if you find it useful. For a complete guide regarding this function, you can refer to this post:How to get local admins of

4.7 Star
42,315 times
Add to favorites
Active Directory
E-mail Twitter del.icio.us Digg Facebook
  • Mr
    2 Posts | Last post December 10, 2019
    • Not working at all neither the function or as command, it clears the screen that all it does :-(
    • Did this on a Windows 2016 server.
      1) Install the AD module for Powershell (Windows Features)
      2) Run Powershell as administrator
      3) At the prompt type in  . .\Get-LocalAdminToCsv.ps1   (take note of the space between the dots)
      4) Get-LocalAdminToCsv -ComputerName MyPCName
  • Check line 107 - Report.csv output not generating in LocalAdminsreport folder
    2 Posts | Last post May 29, 2019
    • Hi Mahdi,
      This script is running fine, but the Report.csv output is not generating in the LocalAdminsReport(timestamp) folder. Errorlog.txt generates correctly.
      I ran a search on the volume (C:\), there is no Report.csv being generated anywhere. Mahdi, please check line 107 and determine if an additional output command is required. Right now the script is still running and is on 256/1132 domain computers. Does the script have to finish before the Report.csv output is generated?
      Thank you for your hard work on this script.
    • Hi Mahdi,
      The script finished and did not produce a Report.csv output file anywhere on my domain controller's C: drive.
      I ran the script on a Server 2008 R2 system, by the way. Any ideas?
  • I dont get eny error
    1 Posts | Last post May 20, 2019
    • Hi, 
      I run the scrip but i dont have the report or the error. I ran the script in dc 2008 r2 and windows 10. 
      what can i do? 
  • Error accessing
    1 Posts | Last post May 09, 2019
    • Hi guys, does this error occur in some computers "Error accessing" and the computer responds well to me the ping, some solution?
      Thank you so much.
  • Scan OU or a tst file
    1 Posts | Last post April 05, 2019
    • Has anyone gotten this to work by limiting to a specific OU and/or to read a flat .txt file and only scan the machines listed in the file?
  • No CSV File
    2 Posts | Last post March 01, 2019
    • Hi,
      I finally got this script to run using comment from "tamf" below.
      However, I cannot seem to find the .csv file....
      Has anyone else gotten this same result? If so, has anyone gotten it to work?
      Thanks in advance!
    • you can do a search on the volume you ran it on for errorlog.txt or report.csv, but it seems to make a folder under the location of where your shell is at with "localadminreport" as the first part of the folder name.
  • It doesn't work for me.
    3 Posts | Last post March 01, 2019
    • Windows 7, latest PS with all modules, I just will be returned to a blank screen like many others.
    • same issue
    • Add Get-localAdmintoCSV to the end of the script outside of the function to call the function, it should run then.
  • modify script for remote desktop user group
    1 Posts | Last post November 14, 2018
    • Can we get output fro all local groups? for example remote desktop users and ko?
  • hi Mahdi i run the tool but error .txt only created but report.csv not crerated
    1 Posts | Last post October 04, 2018
  • No output!
    4 Posts | Last post August 31, 2018
    • Tried running the script multiple times on multiple DCs but I'm not getting any output. Are there any changes required to the script?
    • Same issue as others below with running and then returned to prompt.
      Solution from "CAMARA Emmanuel" resolved this
    • 1. first locate the directory where this script is for example C:\Temp
      2. Then run the script and you will be returned in the same directory.
      3. Then run it like below (you have to put two dots with blank space in between) it will help to call the function "Get-LocalAdmintoCsv"
      C:\temp\. .\Get-LocalAdmintoCsv
      4. Then run the command as you need to run like on entire directory or OU ...
      Hope it will help!
    • I can't get the script to scan a text file.
      Changes I made:
      - Created clients.txt and populated with computer names
      - Added line at start "$Computers = Get-Content c:\temp\clients.txt"
      - Replaced all instances of "$ComputerName with $Computers
      Script still querying full domain?
1 - 10 of 48 Items