Re: Running Login Script after establishing a VPN connection



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.




.



Relevant Pages

  • Re: Subst question
    ... > In a batch file, the @ symbol at the beginning of a line will hide the ... which you can see at a command prompt when you type ... > also limit it to one easily if you type in: echo %OS% ... is this say if the OS is NOT Windows NTgo to logoff or IS Windows ...
    (microsoft.public.scripting.vbscript)
  • Re: new script
    ... The caret character ^ is required when generating test.vbs ... I'm really thankfull for your help (and script). ... #echo>> c:\test.vbs ... remove them before running the batch file. ...
    (microsoft.public.windows.server.scripting)
  • Re: Windows NT Command Script problem
    ... and run a script to copy what needs to be ... >>@echo off ... >>rem END of command file ... >>operable program or batch file. ...
    (microsoft.public.windows.server.scripting)
  • Re: Creating a script to search and replace files in XP
    ... You probably need a batch file. ... How does the script know if the file is unconverted? ... Remove the word "echo" ... echo del "%old% ...
    (microsoft.public.windows.file_system)
  • Re: Logon script for printers
    ... Create a batch file containing lines of the following ... Configure a logon script policy. ... a Windows Explorer dialogue and copy your batch file to this directory. ... 2000 clients, it takes a little longer for Windows XP clients. ...
    (microsoft.public.windows.server.scripting)