Discussion Locked

Creating a Visual Basic Login Script

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Does anyone know how I can make a Visual Basic Script do the same thing as the batch file below?

-----BEGIN BATCH FILE-----

ECHO OFF
CLS

ECHO PLEASE WAIT WHILE SYSTEM SETTINGS ARE VERIFIED!
NET USE * /delete /y
NET USE f: \\ntecelectronic\vol1
NET USE g: \\ntecbfs\skills
REM (TEST USE ONLY) NET USE h: \\ntecadmin\schlastc
NET USE i: \\ntecbfs\ged2001
NET USE m: \\ntecbfs\fcat10m
NET USE n: \\ntecbfs\sat
NET USE o: \\ntecbfs\sam2k
NET USE q: \\ntecbfs\pway
NET USE r: \\ntecbfs\fcat10r
NET USE s: \\ntecbfs\steck
NET USE t: \\ntecbfs\styles
REM (TEST USE ONLY) NET USE u: \\ntecadmin\starmath
REM (TEST USE ONLY) NET USE v: \\ntecadmin\stardata
NET USE x: \\ighsbfs\students
CLS

if Windows_NT == %OS% goto WINNT

\\ighsadmin\netlogon\wfncopy.exe

echo Prepared To Run Shortcut Installer: Windows 98 and Windows 95 Version!
DELTREE /y c:\windows\startm~1\Learning
MD c:\windows\startm~1\Learning
COPY \\ighsadmin\netlogon\Learning c:\windows\startm~1\Learning
CLS
ATTRIB +H +R c:\windows\intern~1.bmp
ATTRIB +H +R c:\windows\applic~1\micros~1\intern~1\intern~1.bmp
CLS
MD c:\windows\Icons
COPY \\ighsadmin\netlogon\Icons c:\windows\Icons
CLS

REGEDIT /s \\ighsadmin\netlogon\custom.reg

goto END

:WINNT
echo Prepared To Run Shortcut Installer: Windows NT Version!
DELTREE /y c:\docume~1\%username%\startm~1\Learning
MD c:\docume~1\%username%\startm~1\Learning
COPY \\ighsadmin\netlogon\W2KLearn c:\docume~1\%username%\startm~1\Learning
CLS
DELTREE /y c:\Icons
MD c:\Icons
COPY \\ighsadmin\netlogon\Icons c:\Icons
CLS

:END
CLS
EXIT
CLS

-----END BATCH FILE-----

4 replies

by techrep

You could write a program with single main.bas routine that executes the commands in your batch file one at a time. You would have to use the Shell command over and over. This would be messy.

A more simple solution is to write a single shell command that executes your entire batch file. This makes it easy to modify your login commands, too, by just modifying the batch file from time to time. Something like this would work:

Sub Main()
Dim rcl as long
rcl = Shell("c:\login.bat", 7)
End
End Sub

by inletgrovehs

I wanted to move away from batch files as they have shown to run more slowly than newer forms of login scripts.

by inletgrovehs

Well, that may work. However I wanted to aviod using the batch file, as it runs very slow compared to the speed of the VB script.

I have already started working on this VB Script and I can map the drives without a problem. However I am having trouble getting it to copy entire directories.

This discussion is closed to new replies.