Guys:
I'm having a strange problem with a large KixForms project. The tool queries a remote server via registry info and WMI and displays it in a form. One function reboots the server, monitoring it as it shuts down and restarts. When the server is back up ("up" = responds to ping, then returns an "xnet list" with no "start pending" results), the form is cleared and the function that queries the target and updates the form is called. At this point, the script exits with the following message:
Code:
ERROR : unexpected command!
Script: D:\dev\SIT\smit.kxw
Line : 954
If I comment out the clear/re-query function calls, no error occurs. Also, if I query another server, it succeeds. However, if I then query the server that was rebooted, the error occurs!
The line being referenced is the first of the WMIQuery() series of function calls.
Code:
$HW_00 = WMIQuery('Manufacturer', 'Win32_ComputerSystem', $System)[0]
I'm at a loss as to why this function works the first time, works multiple times, works on another server after a reboot of a target, but fails any time a server rebooted via the tool reruns the query.
I'd post the code, but at 125K, it's a bit challenging. I'll zip/email it to anyone that wants to play with it, but I'm really wondering if there's something I'm missing with how WMI works, or possibly not properly clearing a WMI connection??
Thanks in advance,
Glenn
_________________________
Actually I
am a Rocket Scientist!