If I ask for exactly the number of items available, I get them. If I ask for more than is available, I don't get an error message for the first failure. Starting at index 0 doesn't help (and causes the first item to be returned twice). Code: v:\> do i=1 to 7 ( echo %i & wmiquery . "SELECT StartTime from Win32_logonsession" %i ) 1 20140611115217.443054-240 2 20140719191920.059415-240 3 20140715105813.866117-240 4 20140611115217.427453-240 5 6 Error (SYS): Incorrect function. 7 Error (SYS): Incorrect function.