Sign in to follow this  
Followers 0
goodbyeplanet

condion using run(@compSpec.....)

4 posts in this topic

#1 ·  Posted (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 by goodbyeplanet

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

From the Help file - Run:

Return Value

Success: 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 = success

If Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE) = 0 Then

Write your log record here

EndIf

Edited 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 :)

Share this post


Link to post
Share on other sites

From the Help file - Run:

If the return of the Run command is 0 then it failed, otherwise it will return a PID = success

If Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE) = 0 Then

Write your log record here

EndIf

I 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

Share this post


Link to post
Share on other sites

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" :x


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 :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0