Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Scripts to add Printers and drives at logon 3

Status
Not open for further replies.

cjpmcg

Technical User
Jun 19, 2006
16
GB
Hi Folks

I know I have seen this somewhere before but do not have the time to spend searching for it, but can anyone supply me with a simple vb script to do the above. I currently use batch files but them seem to give me never ending problems.

ps. are vb scripts more reliable.

Many Thanks
 
Take a look at this FAQ you can take the sections that you need and create a script for your needs.

faq329-5798
 
I use this little kitten;

'-------------------------------------------
' Windows Logon Script for mapping drives.
Dim Network
Set Network = CreateObject("Wscript.network")
Network.MapNetworkDrive "L:", "\\SERVER1\Live" ,true
Network.MapNetworkDrive "P:", "\\SERVER2\Archive" ,true
Network.MapNetworkDrive "R:","\\SERVER2\Released" ,true
Network.MapNetworkDrive "S:", "\\SERVER2\Database" ,true
Network.MapNetworkDrive "T:", "\\SERVER2\Projects" ,true

That should work for you nicely just edit it as you need to in a text file then change the extension to VBS and you're away.

Iain
 
On a basic level this should get you going.

Code:
On Error Resume Next

Dim  WSHNetwork, Path

Set WSHNetwork = CreateObject("WScript.Network")

'Map network drives
WSHNetwork.MapNetworkDrive "L:", "\\server\share1"
WSHNetwork.MapNetworkDrive "M:", "\\server\share2"


'Install Printers
WSHNetwork.AddWindowsPrinterConnection "\\Server\printer"


'Clean Up Memory

set WSHNetwork = Nothing

wscript.quit
 
Thanks a million guys yet again the knowledge on this website never ceases to amaze me and everyone so helpful.

Many Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top