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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -