This guide gives the common operating patterns for all scripts. For the deepest per-script details, use the dedicated manuals:
Run from a domain-joined administrative workstation or management server.
Required baseline:
- RSAT Active Directory module installed
- A credential with the delegated rights required by the task
- Local output paths unless a trusted UNC output path is explicitly allowed
- PowerShell execution policy and script signing controls aligned with your environment
PowerShell version requirements:
Scan-ADComputers.ps1: PowerShell 7+Get-ADAdminActivity.ps1: Windows PowerShell 5.1+Manage-ADUserAccounts.ps1: Windows PowerShell 5.1+
Baseline checks:
Get-Module -ListAvailable ActiveDirectory
Get-ADDomainAll three AD tools accept one credential source at a time:
-Credentialfor an explicitPSCredentialobject.-CredentialSecretNamefor a Microsoft.PowerShell.SecretManagement secret containing aPSCredential.-CredentialPathfor a Windows DPAPI-protected credential exported withExport-Clixml.
SecretManagement is preferred for interactive administrator workstations:
Install-Module Microsoft.PowerShell.SecretManagement, Microsoft.PowerShell.SecretStore -Scope CurrentUser
Register-SecretVault -Name AdminToolsVault -ModuleName Microsoft.PowerShell.SecretStore -DefaultVault
Set-Secret -Name ExampleADCredential -Secret (Get-Credential)
.\Scan-ADComputers.ps1 -ComputerType Server -Mode Full -CredentialSecretName ExampleADCredentialA local CLIXML credential file is useful for single-user, single-machine runs:
$credentialPath = Join-Path $env:USERPROFILE ".admintools\ad-reporting.credential.xml"
New-Item -ItemType Directory -Force -Path (Split-Path $credentialPath) | Out-Null
Get-Credential | Export-Clixml -LiteralPath $credentialPath
.\Get-ADAdminActivity.ps1 -DaysBack 7 -CredentialPath $credentialPathCredential files must be outside the repository directory. UNC credential paths are blocked unless -AllowNetworkInputPath is supplied. On Windows, Export-Clixml protects PSCredential secrets with DPAPI for the same user on the same computer; do not treat those files as portable credentials.
Computer inventory:
.\Scan-ADComputers.ps1 -ComputerType Server -Mode FullAdmin activity audit:
.\Get-ADAdminActivity.ps1 -DaysBack 7User account password age report:
.\Manage-ADUserAccounts.ps1 `
-Mode Report `
-ReportType PasswordAge `
-ExportFormat Csv,HtmlLocked-out account details:
.\Manage-ADUserAccounts.ps1 `
-Mode LockedOut `
-IncludeEvents `
-DaysBack 7 `
-ExportFormat Csv,HtmlPreview a reset action:
.\Manage-ADUserAccounts.ps1 `
-Mode Reset `
-Identity jsmith `
-Unlock `
-WhatIfRun a full scan:
.\Scan-ADComputers.ps1 -ComputerType Workstation -Mode FullRun a targeted scan:
.\Scan-ADComputers.ps1 `
-ComputerType Server `
-Mode Targeted `
-ComputerListPath ".\serverlist.txt"Use OU scope controls:
.\Scan-ADComputers.ps1 `
-ComputerType Server `
-Mode Full `
-SearchBase "OU=Servers,DC=domain,DC=local" `
-ExcludeOU "OU=Decommissioned,OU=Servers,DC=domain,DC=local"Add operational validation:
.\Scan-ADComputers.ps1 `
-ComputerType Server `
-Mode Targeted `
-ComputerListPath ".\serverlist.txt" `
-TestMethod WinRM `
-ResolveDns `
-TestPorts 445,5985,5986 `
-SeparateStatusExportsUse a JSON config file. Start from the committed sample, then keep your local runtime file ignored by git:
Copy-Item config/server_config.sample.json config/server_config.json
.\Scan-ADComputers.ps1 -ConfigPath ".\config\server_config.json"Scan-ADComputers.ps1 is the only current script with native -ConfigPath
support.
Run a default audit:
.\Get-ADAdminActivity.ps1 -DaysBack 7Limit results to privileged admins:
.\Get-ADAdminActivity.ps1 `
-DaysBack 30 `
-AdminOnlyQuery specific Domain Controllers and allow partial results:
.\Get-ADAdminActivity.ps1 `
-DaysBack 14 `
-DomainControllers "dc01.domain.local","dc02.domain.local" `
-AllowPartialResultsWrite to a specific CSV:
.\Get-ADAdminActivity.ps1 `
-DaysBack 7 `
-OutputCsv ".\reports\ad-admin-activity\AD_Admin_Activity_Custom.csv"This script does not currently support JSON config files.
Generate multiple user reports:
.\Manage-ADUserAccounts.ps1 `
-Mode Report `
-ReportType UserSummary,PasswordAge,PrivilegedUsers `
-SearchBase "OU=Users,DC=domain,DC=local" `
-ExportFormat Csv,HtmlAudit one user:
.\Manage-ADUserAccounts.ps1 `
-Mode UserAudit `
-Identity jsmith `
-IncludeEvents `
-DaysBack 30 `
-ExportFormat Csv,JsonReport lockouts with event details:
.\Manage-ADUserAccounts.ps1 `
-Mode LockedOut `
-IncludeEvents `
-DaysBack 7 `
-AllowPartialResults `
-ExportFormat Csv,HtmlReset a password using a generated temporary password:
.\Manage-ADUserAccounts.ps1 `
-Mode Reset `
-Identity jsmith `
-ResetPassword `
-GenerateTemporaryPassword `
-ShowGeneratedPassword `
-ChangePasswordAtLogonThis script does not currently support JSON config files.
Scan-ADComputers.ps1 supports -WhatIf for report and log creation behavior:
.\Scan-ADComputers.ps1 `
-ComputerType Server `
-Mode Full `
-ExportFormat Csv,Html `
-WhatIfManage-ADUserAccounts.ps1 supports -WhatIf for account-changing reset
actions:
.\Manage-ADUserAccounts.ps1 `
-Mode Reset `
-Identity jsmith `
-Unlock `
-WhatIfGet-ADAdminActivity.ps1 is read-only against AD and event logs. It does not
modify AD objects.
- CSV exports are sanitized by default.
- Existing outputs are not overwritten unless
-ForceOverwriteis supplied. - Network output paths are rejected unless
-AllowNetworkOutputPathis supplied. - Network input paths are rejected unless the relevant script supports
-AllowNetworkInputPathand it is supplied. - Domain Controller names are validated before event-log queries.
- Generated temporary passwords are displayed only when
-ShowGeneratedPasswordis explicitly supplied.