Setup
Download the AD scan script from Stoïk Protect and run it in PowerShell on a machine joined to your domain.
Prerequisites
Windows version:
Windows 10 or later on a workstation
Windows Server 2016 or later on a server (must have recent security patches applied)
Internet access: outbound HTTPS (port 443), without SSL inspection, to:
api.prod.ad-scan.cyber.stoik.ioad-scan-prod-pingcastle-zip.s3.eu-west-1.amazonaws.comad-scan-prod-reports.s3.eu-west-1.amazonaws.com
Enrolled in Active Directory and connected to the domain controller
Logged in to a domain administrator account
Unsigned script execution allowed:
Option A:
Set-ExecutionPolicy Unrestricted -Scope LocalMachineOption B: Add the binary file to the ignore list in Defender or a similar solution, then run
Set-ExecutionPolicy Bypass -Scope Processand run the script.
Script downloaded within the last 24 hours
Latest version of PowerShell installed, check with:
$PSVersionTable.PSVersion
Running the scan
Re-running 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.
A script can be run on several machines during its 24 hours, and downloading a new one does not cancel the previous one. Each run replaces the previous results for the domain it scanned. New results show up a few seconds after the script ends.
Automatic scan with Stoïk MDR
For Stoïk MDR customers on CrowdStrike, Stoïk runs the script once a month through CrowdStrike, on a machine that CrowdStrike identifies as a domain controller. The machine and the date cannot be chosen. The script runs with the domain controller's own account, so it sees everything a Domain Admin sees. For SentinelOne and Microsoft Defender customers, the script must be run manually.
AD Scan > Settings lists the automatic runs and their status. A failed run is not retried before the next month, but you can run the script manually at any time. The most common cause of failure is a domain controller on Windows Server 2016 or older, see "Could not create SSL/TLS secure channel". To stop automatic runs, contact protect@stoik.io.
Deleting leftover files
The script deletes its files when it ends. If files are left behind (for example after a run with -KeepLog or -NoDelete), run this command in a PowerShell opened as administrator, from the folder where you ran the script:
Troubleshooting
If the script fails, see Setup errors. For what the script sends to Stoïk and why it is not signed, see Common questions.
Last updated


