goodbyeplanet Posted January 13, 2011 Posted January 13, 2011 (edited) please forgive my title i meant to say condition using run(@compSpec.....) my code first checks if vnc server process is running or not. if it is nor running then it executes the code below. What I need now is a further condition that tests if Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE) worked or not. if it fails to start vnc server then it records to the log file that script failed to start vnc services....thank you for your help.... Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE) Edited January 13, 2011 by goodbyeplanet
enaiman Posted January 13, 2011 Posted January 13, 2011 (edited) From the Help file - Run:Return ValueSuccess: The PID of the process that was launched. Failure: Returns 0 and sets @error to non-zero. If the return of the Run command is 0 then it failed, otherwise it will return a PID = successIf Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE) = 0 Then Write your log record hereEndIf Edited January 13, 2011 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Varian Posted January 13, 2011 Posted January 13, 2011 From the Help file - Run:If the return of the Run command is 0 then it failed, otherwise it will return a PID = successIf Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE) = 0 Then Write your log record hereEndIfI just had that conversation an hour or so ago. The problem is that it is returning the PID from the @Comspec (or the net command). Check thread and adapt
enaiman Posted January 13, 2011 Posted January 13, 2011 I was wondering about that myself, well I have the answer now - thanks. You gave the OP the answer too - no need for me to "adapt" SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now