Solved

login script not running properly with windows 2003

Posted on 2004-09-14
7
280 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
Comment Utility
>   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
Comment Utility
yes there is, thanks
I corrected that but the problem this persist
any more suggestions
0
 

Author Comment

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

post any suggestions
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 10

Accepted Solution

by:
jhautani earned 250 total points
Comment Utility
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
Comment Utility
thanks it worked
0
 
LVL 10

Expert Comment

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

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

Author Comment

by:jasetechtt
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now