MSFN Forum: Unattended Batch Scripts - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Unattended Batch Scripts Rate Topic: -----

#1 User is offline   rathcoffey 

  • Group: Members
  • Posts: 8
  • Joined: 03-February 05

Posted 21 February 2005 - 01:59 PM

Hi all

I have a query that I hope somone can help with.

Within the WAN I maintain, there are multiple subnets i.e. 192.168.1.X ...... 192.168.2.X

I would like to know is it possible to have the script I use when my unattended WinXp installation is finished to look at what subnet its on and call on a script to install the software from a specific location. i.e. If subnet=192.168.2.X then run InstallA.bat, if subnet=192.168.3.X then run InstallB.bat and so on.

Any ideas or help greatly appreciated.

Thanks

Rathcoffey


#2 User is offline   Bâshrat the Sneaky 

  • aka Wim Leers
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,214
  • Joined: 29-October 03
  • OS:none specified
  • Country: Country Flag

Posted 21 February 2005 - 02:11 PM

Wrong forum... Should be moved to Unattended Windows

#3 User is offline   FrankE9999 

  • Member
  • PipPip
  • Group: Members
  • Posts: 115
  • Joined: 16-March 04

Posted 21 February 2005 - 02:23 PM

A simple batchfile to determine which network you are in. Note that the goto :EOF isn't needed here as you don't return to this script after executing the InstallX.bat batch file. If you need to return use "call InstallX.bat" in place of "InstallX.bat".

@echo off
ipconfig | find "IP Address" | find "192.168.1." >nul:
if not errorlevel 1 (
echo In 192.168.1.x network
InstallA.bat
goto :EOF
)
ipconfig | find "IP Address" | find "192.168.2." >nul:
if not errorlevel 1 (
echo In 192.168.2.x network
InstallB.bat
goto :EOF
)

If you are installing the same software but from a different location you could replaxe the InstallX.bat with a net use command to map the network drive.
@echo off
ipconfig | find "IP Address" | find "192.168.1." >nul:
if not errorlevel 1 (
echo In 192.168.1.x network
net use z: \\server\share
goto :Install
)
ipconfig | find "IP Address" | find "192.168.2." >nul:
if not errorlevel 1 (
echo In 192.168.2.x network
net use z: \\server\share
goto :Install
)
:Install
rem install softeare here

rem delete mapped drive
net use z: /delete

#4 User is offline   rathcoffey 

  • Group: Members
  • Posts: 8
  • Joined: 03-February 05

Posted 23 February 2005 - 04:52 AM

@FrankE9999: Thanks for that....thats exactly what i wanted. Big star for you

@Bâshrat the Sneaky: Sorry about that. Great work on the driverpacks.....you're a legend!

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy