Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
done = @FALSE While !done ErrorMode (@OFF) tRemoteConn(StrCat("\\", hostname)) ErrorMode (@CANCEL) err=tGetLastError() Display(2, err, err) EndWhileI am always getting an error code returned of -2147481648. Is this correct? I was expecting a 0.
I am using Process Extnder version 10013.
If I keep that code running in its loop, and execute the code a second time, that second one returns a 0, but the other one continues to produce the 214...... error.
why does the first one not release the error or continue to not connect?
I think I tracked down the issue. Basically the problem is that the tRemoteConn function merely calls the PdhConnectMachine API to handle the remote connection. The PdhConnectMachine function connects to the specified computer, and creates and initializes a computer entry in the PDH DLL.
Once the PdhConnectMachine function successfully connects, any subsequent calls in that script to the PdhConnectMachine function don't query the status of the remote machine. A good connection is assumed.
In short the tRemoteConn function cannot be used to query the status of the remote machine. Maybe use a Ping command instead.
Here are the results of my tests:
Test #1:
Remote System OFF tRemoteConn = 0 | tGetLastError = 2147485648 Remote System RESTARTED (Note: There is quite a delay before results update) tRemoteConn = 1 | tGetLastError = 0Test #2:
Remote System ON tRemoteConn = 1 | tGetLastError = 0 Remote System SHUTDOWN tRemoteConn = 1 | tGetLastError = 0As you can see, Test #2 never picks up the fact that the remote system was shut down. I believe this is simply how the PDHConnectMachine function works. Note: The PDH library offers a function called PdhEnumMachines that apparently returns a list of the names of the computers that have been opened previously by the PDH DLL. Its possible that you could call this function to determine if the system has already made a successful connection. However the current version of the Process extender doesn't contain this functionality. Also I am not sure that will help you accomplish what your looking to do.
I recommend using one of our Ping function to ping the machine to see if its available on the network...
Article ID: W16853
File Created: 2007:07:03:14:26:36
Last Updated: 2007:07:03:14:26:36