Problems using 'usnchanged' to poll for AD changes (Powershell) -
i have been writing interface product called successfactors , i'm having issues component of it.
part of script simple ad extract, however, using previous highestcommittedusn adrootdse extract changes (rather complete ad extract).
the relevant lines shown below;
$dse = get-adrootdse $ou = @('**various ou's**') $activedirectory = $ou | foreach { get-aduser -filter * -properties * -searchbase $_ } $oldadtimestamp = get-content ".\adtimestamp.txt" $adusers = $activedirectory | {$_.usnchanged -gt $oldadtimestamp} | foreach {$_} $dse.highestcommittedusn > adtimestamp.txt
i run through $adusers , output relevant data array exported csv outside of loop.
the problem i'm having this; if perform multiple extracts throughout day, works correctly. however, if leave weekend , run script, i'm getting empty csv or complete ad extract. there seems no pattern it.
am doing wrong?
many thanks, tom
target single dc not whole domain. each dc has different highestcommittedusn
try
$dse = get-adrootdse -server <servername>
Comments
Post a Comment