AD scan setup
Prerequisites
The endpoint (workstation or server) used for the scan deployment must meet the following prerequisites:
Windows version
Windows 10 or later on a workstation
Windows Server 2012 R2 or later on a server
Internet access
Enrollment in Active Directory and connection to the domain controller
Logged in to a domain administrator account
Allow execution of unsigned scripts
First solution -> Run the following command:
Set-ExecutionPolicy Unrestricted -Scope LocalMachineSecond solution -> Add the binary file to the ignore list in Defender or a similar solution. Then, modify the execution policy:
Set-ExecutionPolicy Bypass -Scope Process, and then run the script.
Use a script downloaded within the last 24 hours
Have the latest version of PowerShell installed
Run the following command to check the current version:
$PSVersionTable.PSVersion
Initial setup
Click on
Active DirectoryDownload the script

Run the script in a PowerShell console from an endpoint that meets the prerequisites mentioned above.
Re-run the scan
Updating the AD scan is manual: each new run must be initiated manually. The downloaded script is only valid for 24 hours: after this time, you must download it again.
The scan can be rerun as many times as necessary:
Under normal operation, we recommend running it monthly
During infrastructure security hardening phases, it can be run more frequently to verify that misconfigurations have been corrected.
Debugging the AD scan
Script closure after execution
This means that script execution is restricted in the terminal. Here's a three-step solution:
Download the script and go to Downloads, then type
powershell -ep bypassin the search bar:The PowerShell console should open automatically. Once it does, type
&and press Tab until the correct script file is visible:Press Enter.
PingCastle interruption
In this case, ensure that both of these conditions are met:
You have an internet connection to its domain controller
Your firewall is not blocking access to https://api.prod.ad-scan.cyber.stoik.io
Delete data after script execution
If you wish to delete the data after the script has run, you can execute the following command:
Last updated
Was this helpful?

