Solved

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

Posted on 2009-06-29
3
414 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

776 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