Solved

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

Posted on 2009-06-29
3
416 Views
Last Modified: 2013-12-24
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
0
Comment
Question by:Multimatic
3 Comments
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 24737009

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

0
 
LVL 10

Accepted Solution

by:
TakedaT earned 500 total points
ID: 24737019
I have something running for this at my current job.  It depends on how your network is setup, but here is what I have running in my login scripts before any installs run.

Of course, it would need to be modified to suit your particular situation.
ipconfig /all | findstr /c:"IP Address" | findstr /c:"192.168.x.">nul && (
	goto install
)
ipconfig /all | findstr /c:"IP Address" | findstr /c:"172.16.x.">nul && (
	goto install
)
 
goto end
 
:install
(installs go here)
 
 
:end

Open in new window

0
 
LVL 1

Author Closing Comment

by:Multimatic
ID: 31597964
Super fast response and a very simple yet effective solution!

Cheers
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question