I'm currently running into an issue with one of my deprovision scripts. Basically, when a user gets deprod I have a series of scripts run that accomplish a bunch of different tasks. At the end of the depro, an email report is sent to IT stating what was done, and listing their current groups to confirm they were removed from all groups. I attempted to put a sleep command in at the beginning of the final script in order to give the groups time to propagate to all of our AD servers. Unfortunately using "start-sleep" doesn't actually seem to work. Am I crazy, or is there something else I could do in the deprovision scripts in order to get a sleep to work?
Here's a snippet of the script:
$logfile = "C:\Foo\$sam.txt" "<b>START AD Profile Verification</b>`n<br /><ul>" | Out-File -FilePath $logfile -Append -NoClobber "<li>Waiting 120 seconds for group propagation - $logDate</li>`n" | Out-File -FilePath $logfile -Append -NoClobber Start-Sleep -s 120 "<li>120 seconds should have passed... - $logDate</li>`n" | Out-File -FilePath $logfile -Append -NoClobber
I've put the timestamp in to confirm whether or not the script is actually sleeping, I can confirm it just skips over the command, and does not actually wait the 120 seconds.