Consolidated Login Script
Novell Cool Solutions: Tip
By Jason Riebe
Digg This -
Posted: 21 Dec 2006
We had a requirement to map drives to both NetWare Servers and MS Servers rather than manage multiple login scripts or having dos boxes pop up while executing the net use mappings.
We wrote a simple VB script that does the mapping quickly and quietly. The benefit is that we now have a consolidated login script that is easy to read and maintain via edir group memberships. The line in the login script to execute this VBS is:
@wscript.exe r:\networkapps\scripts\mapdrive.vbs "P" "\\servername\sharename$"
'* Script : MapDrive.vbs '* Purpose: This example Maps a K drive to a Windows share called "data" '* Usage : Runs from network shortcut or login script ' : Syntax: MAPDRIVE.VBS "<driveletterwithoutcolon>" "<\\servername\sharename>" ' : eg. MAPDRIVE.VBS "K" "\\server\data" '* '* Turn off error trapping On Error Resume Next '* Declare the necessary variables Dim Wsh, Net, Arg Set Wsh = Wscript.CreateObject("Wscript.Shell") Set Net = Wscript.CreateObject("Wscript.Network") Set Arg = Wscript.Arguments '* If the incorrect number of arguments were supplied, quit immediately without reporting an error If Arg.Count <> 2 Then Wscript.Quit '* (Re)Map the drive if it doesn't already point to the correct location If UCase(Wsh.RegRead("HKCU\Network\" & Arg.Unnamed(0) & "\RemotePath")) <> UCase(Arg.Unnamed(1)) Then Net.RemoveNetworkDrive Arg.Unnamed(0) & ":", True, True Net.MapNetworkDrive Arg.Unnamed(0) & ":", Arg.Unnamed(1), True End If '* End of script WScript.Quit
We are runing XP SP2 with Client 4.91 SP2 and NetWare 6.5 SP5.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com