Icebun
(Fresh Scripter)
2019-10-07 01:43 PM
How to prevent Kix script running if a condition is not met

For some laptop users, that connect to the network using a (Watchguard) VPN client, I need to first check if the VPN has been activated before running Kixtart.

When the VPN is running, a particular process (wgsslvpnsrc.exe) will be running in Task Manager or an IP address (10.100.106.x) will be allocated from a pool.


Is it possible for kixtart to detect either of these?

If so, a hint on the syntax would be useful.

Thanks.


Glenn BarnasAdministrator
(KiX Supporter)
2019-10-07 01:57 PM
Re: How to prevent Kix script running if a condition is not met

Check out this UDF which returns a list of running processes.

The last post in that thread has some examples - basically, check for that process and exit if it is present/running.

Glenn


Mart
(KiX Supporter)
2019-10-07 04:53 PM
Re: How to prevent Kix script running if a condition is not met

Another option would be to check the IP address.
Please be aware that @IPADDRESS marcos return three characters for each octet. So "10.1.20.123" will be " 10. 1. 20.123". Counting 12 characters from the left will give you everything from the left including the dot between the third and fourth octet.

 Code:
If Left(@IPADDRESS0, 12) <> " 10.100.106."
	;Do stuff if NOT on VPN
Else
	;Do stuff for VPN users or just do nothing
EndIf


Icebun
(Fresh Scripter)
2019-10-09 08:00 AM
Re: How to prevent Kix script running if a condition is not met

Guys,

I really appreciated the responses!

Mart, I have applied your solution and this works.

Thanks again everyone and its really nice to know Kixtart still lives on.