Re: Running Login Script after establishing a VPN connection
- From: TJCooper1972 <TJCooper1972@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 15 May 2008 11:58:01 -0700
Got it..im an idiot!!!!!
This works just fine!!
Set objNetwork = Wscript.CreateObject("Wscript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & ADSysInfo.UserName &"")
Set WshShell = WScript.CreateObject("WScript.Shell")
wshshell.run "\\domain\netlogon\region\bat.bat"
Now I just have to create the correct path from info pulled in the user
account object
Thank you all for putting up with my obvious newbieness!!
"Al Dunbar" wrote:
Wait a minute, the script shown is a kixtart script. Instead of writing a.
script in another language, whether batch or vbscript, why not just get
kixtart to run the script?
/Al
"Pegasus (MVP)" <I.can@xxxxxxxxxx> wrote in message
news:%23$cgODRtIHA.2292@xxxxxxxxxxxxxxxxxxxxxxx
"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.
- 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
- Re: Running Login Script after establishing a VPN connection
- From: Pegasus \(MVP\)
- Re: Running Login Script after establishing a VPN connection
- From: Al Dunbar
- Running Login Script after establishing a VPN connection
- Prev by Date: Re: Running Login Script after establishing a VPN connection
- Next by Date: Re: Books/References new to scripting in AD/2003
- 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
|