Login Script

Various VB Scripts
Post Reply
thockman
Site Admin
Posts: 104
Joined: Thu Dec 15, 2005 5:51 pm
Location: Kansas City
Contact:

Login Script

Post by thockman » Sun Apr 05, 2009 9:09 pm

Here is a simple vbs script to use for mapping drives and such in AD.

Code: Select all

ON ERROR RESUME NEXT
' Script: Logon.vbs
' Description: Logon script for all users in domain
' Created by: Troy Hockman
' Created Date: 11/24/03

' Get username
Set objNetwork = WScript.CreateObject("WScript.Network") 
strUserName = objNetwork.UserName 
' Remove network drives
Dim oNetwork
Set oNetwork = WScript.CreateObject("WScript.Network")
oNetwork.RemoveNetworkDrive "H:"
oNetwork.RemoveNetworkDrive "M:"
oNetwork.RemoveNetworkDrive "P:"
'oNetwork.RemoveNetworkDrive "W:"

' Add network drives
oNetwork.MapNetworkDrive "H:", "\\FileServer\" & strUserName & "$"
oNetwork.MapNetworkDrive "M:", "\\FileServer\Share1"
oNetwork.MapNetworkDrive "P:", "\\FileServer\Share2"


' Add network printer
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\PrintServer\HPLJ6P"
WshNetwork.SetDefaultPrinter "\\PrintServer\HPLJ6P"
Set WshNetwork = Nothing
Set oNetwork = nothing

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest