Jump to content
Sign in to follow this  

Check IP Subnet / Check VPN Site?

Recommended Posts


Hi folks,

I've been using AutoIT for a while to handle some basic logon scripts and GUI interfaces. The main one I have running is a logon script which does a version check of a bespoke software package that we use which runs the update process as admin on logon if there is a new version available. The software updates are hosted on our main server and this works perfectly at the main site.

However, we've recently opened a second office, and have a seperate network there which is linked to our main via a site-to-site VPN over ADSL. The problem here is that the update script runs fine on logon at the second office, but because it is doing the version check of the software and the update over the VPN, it slows the logon process at the second office to a crawl.

I'm planning on sorting this by replicating the software package install to a server at the second office, but the AutoIT script itself needs to be the same on both sites, so I need a function in there to determine which site the PC belongs to when it runs the script on logon.

What would be the best way to go about this?

I am running a Windows2003 SBS domain, which covers 2 sites linked by a VPN. 1st site has the main server and uses the IP range 192.168.1.*, second has a backup domain controller and uses IP range 192.168.2.*,, so I was thinking of having the script check the IP address of the host computer to tell what site it is on, alternatively is there a way for AutoIT to get the NetBIOS pc name or the location info from active directory?

Any help would be appreciated

Thanks :)

Share this post

Link to post
Share on other sites

Ah, I've discovered the @logonserver and @LogonDNSDomain macros which seem to be a nice easy way of doing what I want - got a basic If statement calling the required update exe depending on the site logon server:


If @LogonServer = "\\SERVER1" Then


ElseIf @LogonServer = "\\SERVER2" Then

Run ("\\SERVER2\NETLOGON\Update2.exe")


Also been playing about with group policies, so should be able to set up individual logon group policies per site - will have a wee play and see which method works better :)

Edited by Spamius

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