Re: Running Login Script after establishing a VPN connection
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Tue, 13 May 2008 17:48:38 +0200
"TJCooper1972" <TJCooper1972@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:349C4FE0-1183-4A8D-A02F-CD6F4D9E8258@xxxxxxxxxxxxxxxx
I have to figure out how to parse the file correctly. I dont do a lot of
scripting, so everything is slow going for me. The file has a number of
mapped drives and commented lines. I can ignore commented lines and focus
on
lines that start with a $. This is what I have to parse:
----------
;
; Windows NT and Windows For Workgroups Logon Script
;
$NameLine = "my region"
$HelpDesk = "555-555-5555"
$Drive1 = M:
$Name1 = "drivea"
$Dir1 = "\\server\mapm"
$Drive3 = W:
$Name3 = "driveb"
$Dir3 = "\\server\mapw"
;
; the following should reflect appropriate mapped drive for location
;
$Drive4 = H:
$Name4 = "drivec"
$Dir4 = "\\server\maph"
$Drive5 = P:
$Name5 = "drived"
$Dir5 = "\\server\mapp"
$Drive6 = k:
$Name6 = "drivee"
$Dir6 = "\\server\mapk"
Your reply is a little too vague to give you a precise
recipe but the following batch file may well do the job.
Here is what you need to do:
- Use copy & paste to copy the code into a batch file.
- Adjust Lines 03 and 04 to suit your own environment.
- Remove the line numbers.
- Test the batch file.
- When happy with the result, activate the batch file by
removing the word "echo" on Line 09.
01. @echo off
02. setlocal enabledelayedexpansion
03. set ShareName=$Dir6
04. set ShareList=c:\Shares.txt
05.
06. for /F "tokens=1,2 delims==" %%a in ('type %ShareList%') do (
07. set Share=%%a
08. set Share=!Share: =!
09. if /i !Share!==%ShareName% echo call %%b\netlogon.bat
10. )
Feel free to ask if you want to know how and why the code works.
.
- Follow-Ups:
- Re: Running Login Script after establishing a VPN connection
- From: Al Dunbar
- Re: Running Login Script after establishing a VPN connection
- References:
- Running Login Script after establishing a VPN connection
- From: TJCooper1972
- RE: Running Login Script after establishing a VPN connection
- From: TJCooper1972
- Re: Running Login Script after establishing a VPN connection
- From: Pegasus \(MVP\)
- Re: Running Login Script after establishing a VPN connection
- From: TJCooper1972
- Re: Running Login Script after establishing a VPN connection
- From: Pegasus \(MVP\)
- Re: Running Login Script after establishing a VPN connection
- From: TJCooper1972
- Running Login Script after establishing a VPN connection
- Prev by Date: AD computer name
- Next by Date: Re: Moving Computer Accounts in AD using .csv file
- Previous by thread: Re: Running Login Script after establishing a VPN connection
- Next by thread: Re: Running Login Script after establishing a VPN connection
- Index(es):
Relevant Pages
|