Solved

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

Posted on 2009-06-29
3
410 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:dstewartjr
Comment Utility

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
Comment Utility
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
Comment Utility
Super fast response and a very simple yet effective solution!

Cheers
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
LDAP find expired users 8 41
one-way data "masking" MD5 sql 26 95
python sqlite question 11 42
What does "flush tables;" do exactly? 7 45
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now