Re: I need help with a login script

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



The script looks ok as far as programming goes.

A couple of things to look at. First make sure that the user id you are using to connect on the client machine is a member of at least one of the groups you have the "IF" statements (e.g. Accounting, Sales... etc). Another thing is the "\\LSNSRV01" is that a member server in the domain? Do the printers map properly?


--
Costas


"John K" <John K@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:F47B4582-5B2D-4D6A-BD28-34ABFF48D58E@xxxxxxxxxxxxxxxx
I have a problem with my login script. It is only mapping the first drive
"H". Am i missing something . Any help willbe appreciated. I am running the
script on a sbs2003 sp2 server with vista and xp clients.

Option Explicit
On Error Resume Next
Const lsn_Accounting_group = "cn=Accounting"
Const lsn_Sales_group = "cn=Sales"
Const lsn_Excecutive_group = "cn=Excecutive"
Const lsn_Operations_group = "cn=Operations"
Const lsn_Programming_group = "cn=Programming"

Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:","\\xxxsrv01\Users\" & wshNetwork.UserName

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://"; & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

If InStr(strGroups, lsn_Accounting_group) Then

wshNetwork.MapNetworkDrive "F:","\\lsnsrv01\Accounting\"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\LaserJet4000"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\3500Color"
wshNetWork.SetDefaultPrinter "\\lsnsrv01\2840Color"

ElseIf InStr(strGroups, Lsn_Sales_group) Then

wshNetwork.MapNetworkDrive "S:","\\lsnsrv01\Sales\"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\LaserJet4000"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\3500Color"
wshNetWork.SetDefaultPrinter "\\lsnsrv01\2840Color"

ElseIf InStr(strGroups, lsn_Excecutive_group) Then

wshNetwork.MapNetworkDrive "X:","\\lsnsrv01\Excecutive\"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\LaserJet4000"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\3500Color"
wshNetWork.SetDefaultPrinter "\\lsnsrv01\2840Color"

ElseIf InStr(strGroups, lsn_Operations_group) Then

wshNetwork.MapNetworkDrive "O:","\\lsnsrv01\Operations\"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\LaserJet4000"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\3500Color"
wshNetWork.SetDefaultPrinter "\\lsnsrv01\2840Color"

ElseIf InStr(strGroups, lsn_Programming_group) Then

wshNetwork.MapNetworkDrive "P:","\\lsnsrv01\Programming\"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\LaserJet4000"
wshNetwork.AddWindowsPrinterConnection "\\lsnsrv01\3500Color"
wshNetWork.SetDefaultPrinter "\\lsnsrv01\2840Color"

End If


.



Relevant Pages

  • Logon Scripts
    ... The first script removes all current mapped drives and the ... 'Set WshNetwork = Wscript.CreateObject ... ElseIf InStrThen ...
    (microsoft.public.windows.server.general)
  • Script doing right?
    ... I have a script the returns only the internal address from IIS. ... ' 0 arg is command can be ... ' 2 arg is username ... elseif Then ...
    (microsoft.public.scripting.vbscript)
  • Re: Script nur einmal für Benutzer anwenden
    ... Dim WshShell ... If iOfficeVer = -1 Then ... Elseif oReg.GetStringValue(_ ... > - Script erstellt beim ersten Ausführen einen Schlüssel in der Registry für ...
    (microsoft.public.de.german.scripting.wsh)
  • Re: Drive Map Script not Reading User Groups
    ... In your script you use LCase for strGroups, ... user has no groups in memberOf, ... > have written a script to map network drives based upon a user's group. ... > ElseIf InStrThen ...
    (microsoft.public.scripting.vbscript)
  • help with logon vbs script
    ... I have the script below which works fine.. ... ' Create objects and extract strGroup values ... Set objNetwork = CreateObject ... ElseIf InStr) Then ...
    (microsoft.public.windows.server.scripting)