MapDrive.vbs

‘MapDrive.VBS Revision: 1
‘Last reviewed: 02/18/02
‘Copyright 2002 Christa Anderson
‘Tell the script to recognize only defined variables.
Option Explicit
‘Define the variables in the script.
Dim oNet, sUserName
‘Create a link to the WshNetwork object and assign
‘it to a variable.
Set oNet = CreateObject("WScript.Network") ‘Set the value of sUserName to the name of the currently
‘logged-on user.
sUserName = oNet.UserName
‘Evaluate the value of sUserName and perform actions
‘based on that value.
Select Case sUserName
Case "ChristaA"
‘Map the network share to a local drive letter, supplying
‘the path to the network share as an argument.
oNet.MapNetworkDrive "X:", "\\server\documents"
oNet.MapNetworkDrive "Y:", "\\server\templates"
Case "Scott"
oNet.MapNetworkDrive "X:", "\\server\documents"
Case Else
oNet.MapNetworkDrive "Y:", "\\server\default"
End Select