Solved

login script not running properly with windows 2003

Posted on 2004-09-14
7
284 Views
Last Modified: 2010-04-19
My login script does not run properly unless the user has admin rights

can anyone help me, i think the problem stems from the the join command in the script

Const LEGAL                = "cn=legal"
Const ADMINISTRATOR   = "cn=admin"
Const HUMAN_RESOURCES = "cn=hr"
Const estates             = "cn=estates"

Set wshNetwork = CreateObject("WScript.Network")
rem wshNetwork.MapNetworkDrive "t:", "\\amdk6\Users\" & wshNetwork.UserName

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

If InStr(strGroups, legal) Then

 wshNetwork.MapNetworkDrive "l:", "\\amdk6\legalfolder"
  wshNetwork.AddWindowsPrinterConnection "\\amdk6\hpbwexec"
   wshNetwork.AddWindowsPrinterConnection "\\amdk6\hpbwgen"
    wshNetWork.SetDefaultPrinter "\\amdk6\hpbwgen"

 ElseIf InStr(strGroups, estates) Then

  wshNetwork.MapNetworkDrive "l:", "\\amdk6\estates"
   wshNetwork.AddWindowsPrinterConnection "\\PrintServer\hpbwnorth"
     wshNetwork.AddWindowsPrinterConnection "\\amdk6\hpbwgen"
      wshNetWork.SetDefaultPrinter "\\PrintServer\Hrbwnorth"

End If
      
0
Comment
Question by:jasetechtt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 10

Expert Comment

by:jhautani
ID: 12059035
>   wshNetwork.AddWindowsPrinterConnection "\\PrintServer\hpbwnorth"
>     wshNetwork.AddWindowsPrinterConnection "\\amdk6\hpbwgen"
>      wshNetWork.SetDefaultPrinter "\\PrintServer\Hrbwnorth"

Is there a typo in your script: ...\hpbwnorth <-> ...\Hrbwnorth
0
 

Author Comment

by:jasetechtt
ID: 12061314
yes there is, thanks
I corrected that but the problem this persist
any more suggestions
0
 

Author Comment

by:jasetechtt
ID: 12061339
yes there is, thanks
I corrected the script but the problem still persist

post any suggestions
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 10

Accepted Solution

by:
jhautani earned 250 total points
ID: 12072568
You were right about the Join function being the problem.
I think I found the solution:
the problem is that if CurrentUser.MemberOf returns only one group ('domain users'  group is not returned) it is not an array but a string, so the Join function fails
Try these lines, they check whether MemberOf returns an array or a string and parses strGroup accordingly:

if isarray(CurrentUser.MemberOf) then
  strGroups = LCase(Join(CurrentUser.MemberOf))
else
  strGroups = LCase(CurrentUser.MemberOf)
end if
0
 

Author Comment

by:jasetechtt
ID: 12081341
thanks it worked
0
 
LVL 10

Expert Comment

by:jhautani
ID: 12095414
I am just wondering... if my suggestion works, then why 'C' ?

http://www.experts-exchange.com/help.jsp#hi73
0
 

Author Comment

by:jasetechtt
ID: 12095995
Well i am sorry i apologise i had to do some research myself, but you deserve a B
i have only now read how this this site grade the answers

accept my apology
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question