powershell - How to use the index property of the DfsrIdRecordInfo WMI class for pagination of WMI queries -
edit: should have posted on serverfault instead? there not dfs-r category on stackoverflow, thought more of scripting\programming question. let me know if should put on serverfault instead.
i attempted use dfsridrecordinfo class retrieve files of large (6000 file) dfsr database , getting wmi quota errors.
doubling , tripling wmi quotas on server did not solve this.
i found looking here index property of class is: "the run-time index of record. value used partition result of large query." sounded wanted, behavior of property not expected.
i found when try paging property not retrieve of records per following example powershell.
i tested on dfsr database less 700 files not throw quota error. because small database can files in less second:
$dfsrfiles = gwmi ` -namespace root\microsoftdfs ` -computername 'dfsrserver' ` -query "select * dfsridrecordinfo replicatedfolderguid = '$guid'" ps f:\> $dfsrfiles.count 680
so have 680 files in dfsr db. if try use index property pagination this:
$starttime = get-date; $i = 0 #index counter $dfsridrecordinfoarr = @() while ($i -lt 1000) { $starttimepage = get-date $startrange = $i $endrange = $i += 500 write-host -foregroundcolor green "on range: $startrange - $endrange" $dfsrfiles = gwmi ` -namespace root\microsoftdfs ` -computername 'dfsrserver' ` -query "select * dfsridrecordinfo index >= $startrange , index <= $endrange , replicatedfolderguid = '$guid'" $dfsridrecordinfoarr += $dfsrfiles write-host -foregroundcolor green "returned $($dfsrfiles.count) objects range" (get-date) - $starttimepage write-host -fo yellow "debug: = $i" } (get-date) - $starttime ps f:\> $dfsridrecordinfoarr.count 517
so returns 517 files.
here full output of debug messages. can see searching way takes super long time:
on range: 0 - 500 returned 501 objects range days : 0 hours : 0 minutes : 1 seconds : 29 milliseconds : 540 ticks : 895409532 totaldays : 0.001036353625 totalhours : 0.024872487 totalminutes : 1.49234922 totalseconds : 89.5409532 totalmilliseconds : 89540.9532 debug: = 500 on range: 500 - 1000 returned 16 objects range days : 0 hours : 0 minutes : 1 seconds : 35 milliseconds : 856 ticks : 958565847 totaldays : 0.00110945121180556 totalhours : 0.0266268290833333 totalminutes : 1.597609745 totalseconds : 95.8565847 totalmilliseconds : 95856.5847 debug: = 1000 days : 0 hours : 0 minutes : 3 seconds : 5 milliseconds : 429 ticks : 1854295411 totaldays : 0.00214617524421296 totalhours : 0.0515082058611111 totalminutes : 3.09049235166667 totalseconds : 185.4295411 totalmilliseconds : 185429.5411
am doing stupid? thinking "run-time index" means index property not statically attached records , generated anew each record every time query run because index properties of objects in $dfsrfiles not match in $dfsridrecordinfoarr.
but if index property different every query have duplicates in $dfsridrecordinfoarr not. records unique, doesn't return of them.
is index property totally useless purpose? perhaps when says "...partition result of large query" means used on records have been returned wmi not wmi query itself.
any guidance appreciated. in advance.
Comments
Post a Comment