Solved

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

Posted on 2009-06-29
3
417 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

762 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