AD Automation Troubleshooting
Cheat sheet · https://pcornel.dk/topic.php?topic=5697
Answer
Troubleshoot AD automation by checking the account's permissions on the target OU, the DC the script talked to and replication delay, correct identity and attribute names, -WhatIf output and error records in $Error.
Remember
- Access denied usually means missing delegation on the OU.
- Results may be on one DC and not yet replicated.
- Wrong filters change the wrong objects.
First checks
$Error[0] | fl * -Force— errorTest-NetConnection <dc> -Port 9389— ADWS reachableGet-ADUser <u> -Server <dc>— target DC
Commands
Get-WinEvent -FilterHashtable @{LogName='Windows PowerShell'} -MaxEvents 50- Read-only/validation observation for recent PowerShell engine/host events around an automation run.
Verify in this order
script → ADWS → DC → permissions → result
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5697