Re: I need help with a login script

Tech-Archive recommends: Fix windows errors by optimizing your registry



John K wrote:
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

"If a user is a mamber of no groups other than Domain Users, the list is
Null. If the user is a member of just one additional group, the value is a
string. If member of two or more groups, an array. Before you try the Join
operation, test to see if the value is an array or not."

http://www.visualbasicscript.com/m_1807/tm.htm



--
/kj


.



Relevant Pages

  • Re: I need help with a login script
    ... Set wshNetwork = CreateObject ... ElseIf InStrThen ... If member of two or more groups, an array. ...
    (microsoft.public.windows.server.sbs)
  • Re: AB=BA
    ... elseif numel>1 ... % verify that A is a square matrix ... error('A must be a real numeric array') ... % find a non-zero solution to this linear system ...
    (comp.soft-sys.matlab)
  • Re: AB=BA
    ... Since its homework, ... elseif numel>1 ... % verify that A is a square matrix ... error('A must be a real numeric array') ...
    (comp.soft-sys.matlab)
  • Re: Excel2000: How to check for Optional parameter=Nothing
    ... ElseIf IsArrayThen ... Cell reference or expression returning a cell reference like ... Array like ... >>> Arvi Laanemets ...
    (microsoft.public.excel.programming)
  • Re: Assign Results from If...Then and Loop to an Array (VBA)
    ... For iCV = 1 To 10 ... ElseIf .IsNumberThen ... Loop into the Array, but I don't see it yet. ... > Dim CellVariableArray As Variant ...
    (microsoft.public.excel.programming)