Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

login script not running properly with windows 2003

Posted on 2004-09-14
7
Medium Priority
?
291 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 10

Accepted Solution

by:
jhautani earned 500 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
Integration Management Part 2
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

926 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