Link to home
Start Free TrialLog in
Avatar of Multimatic
MultimaticFlag for Canada

asked on

Script or batch file to identify if travelling laptop is connected to it's local domain

I need a way to identify if a travelling user is connected to their local domain before running their login script.  This is to avoid installing software and updates across slow WAN links.

Perhaps identifcation by checking AD OU or subnet?


Cheers
Lachlan
Avatar of Don
Don
Flag of United States of America image


Here's an example of a routine you could use in a .bat to determine the subnet by using the default gateway
 

 

for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find "Gateway"') DO SET GW=%%a
if %GW%== 10.63.106.2 set GW=Location1
if %GW%== 10.63.106.130 set GW=Location2
if %GW%== 10.63.106.162 set GW=Location3
if %GW%== 10.63.106.194 set GW=Location4

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of TakedaT
TakedaT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Multimatic

ASKER

Super fast response and a very simple yet effective solution!

Cheers