According to the attached image file it looks like ALL of the devices that were on at the time did return a message. Only two computers in the list didn't have a message but they also show: "Cannot find agent" under the "result" column. Is your image file a good example of what you're actually seeing?
Did those two devices actually do the work of the script, or were they off perhaps?
We see "Cannot find agent" a lot where the common base agent is blown up on a device. Usually, either restarting the "LANDesk Management Agent" service helps this, or reinstalling the service either by reinstalling the whole agent or just the common base agent via its MSI located in the LDclient directory.
If they did run the script, then they simply didn't talk back to the core in time perhaps?
Maybe the shutdown time wasn't long enough for the message to make it back to the core? (big maybe, 60 should be long enough).
The other direction is that they didn't run the script or died somewhere in the middle of it.
You might want to add a log file output to your script that writes locally on the device for further forensic purposes.
You could then write something to it at each relevant point. That might be useful.
On another note, do any of your devices have Windows XP as the OS?
If so, how will you overcome "sticky" profiles on these, or does that not occur in your environment?
I point out XP only, as I'm under the impression (falsely perhaps), that Microsoft corrected this issue in newer OS's.
They did add UPHclean 1.6 (at least) to the user profile manager service in Vista and up, so it might not happen on these,
however in our environment (mostly still running XP), we see a lot of stuck profiles even with UPHclean 1.6 installed and running.
Given our situation, code such as this is not very successful, so we had to come up with a better way to get the same type of results. (ie. reboots when no user is present.)
That may not have been the best screenshot. Under others the status = done, result = no error, but under message it is blank.
I will try added a ping nul command after the message line to give it some time to send the message back to the console.
Another thing I'd look at as perhaps just a point of concern about logic in any scripting language; you might want to consider setting the flag in the For Next loop, and move the commands themselves outside of that loop and use the flag to trigger the commands. You might be getting redundant executions by having the commands inside the loop. Just a thought. I think you had that sort of structure in your initial testing, as the commented out section at the bottom of the code suggests.
Just a thought.
Thanks, adding a bit of a ping pause of 30 seconds after the message sent back to the console appears to have resolved the issue on most of them, just the odd few not reporting back now which I'm happy with.
Cool, and interesting outcome. Good to know.
You might want to mark this answered, unless you want to get more answers.