Solved

login script not running properly with windows 2003

Posted on 2004-09-14
7
283 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
  • 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 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