TechTutorials - Free Computer Tutorials  

How to Convert Login Scripts From Batch Files to VBS Scripts 

Added: 10/22/2004, Hits: 4,292, Rating: 0, Comments: 0, Votes: 0
Add To Favorites | Comment on this article
I had a client that I moved to active directory and I wanted to change their login scripts from batch files to vbs scripts. The batch files were very simple and consisted of:

Code :

net use j: \scifssys
net use s: \scifsshared
net use m: \scifscompanydata
net use u: \scifsusers%username%

I wanted the script to map the same drives, but I couldn't find any info on how to do the %username% folder. Anyway, here is the script that I finally got to work. Of course, modify your server and share names to suit your environment.

Code :

Dim objNet, strUserName

Set objNet = CreateObject("Wscript.Network")

objNet.MapNetworkDrive "J:", "\scifssys"
objNet.MapNetworkDrive "S:", "\scifsshared"
objNet.MapNetworkDrive "M:", "\scifscompanydata"
objnet.MapNetworkDrive "U:", "\scifsUsers" & objnet.UserName

' End of VBScript

Comments (0)

Be the first to comment on this article

Related Items

7 Seconds Resources, Inc.

IT Showcase