Announcement

Collapse
No announcement yet.

basic script from ms but doesnt work

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • basic script from ms but doesnt work

    ok i'm starting to play with 2003 on a remote site i have that has to run a ms environment due to some proprietary dbase they run

    the server is in ok and dns , dhcp etc are all fine

    im ok with the rights and all that kind of stuff and i want to
    tie everything down with groups

    i have a script configured in the gpo (simple one - cut and pasted from ms site but i get an error on line 8 saying type mismatch: "join"
    line 8 is - strGroups = LCase(Join(CurrentUser.MemberOf))
    i've only tried this on one pc - it's 2000 with sp4 - the home drive maps no probs

    the script is


    Const typing = "cn=typing"

    Set wshNetwork = CreateObject("WScript.Network")
    wshNetwork.MapNetworkDrive "h:", "\\nemesis\home\" & wshNetwork.UserName

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

    If InStr(strGroups, typing) Then

    wshNetwork.MapNetworkDrive "g:", "\\nemesis\typing\"


    ElseIf InStr(strGroups, FINANCE_GROUP) Then

    wshNetwork.MapNetworkDrive "g:", "\\FileServer\Finance\"
    wshNetwork.AddWindowsPrinterConnection "\\PrintServer\FinLaser"
    wshNetWork.SetDefaultPrinter "\\PrintServer\FinLaser"

    ElseIf InStr(strGroups, HUMAN_RESOURCES_GROUP) Then

    wshNetwork.MapNetworkDrive "g:", "\\FileServer\Human Resources\"
    wshNetwork.AddWindowsPrinterConnection "\\PrintServer\HrLaser"
    wshNetWork.SetDefaultPrinter "\\PrintServer\HrLaser"

    End If


    can anyone tell me what is wrong with this - i'm afraid i'm a netware guy so my vbs scripting knowledge is nill - afraid i was allways crap at programming

  • #2
    not a vb expert

    but it seems to me that u didnt' solid with capital and const commands of all your groups, which is important but not sure that is the cause for mailfunction...

    Const FINANCE_GROUP = "cn=finance"
    Const HUMAN_RESOURCES_GROUP = "cn=human resources"

    the only thing i can think of is that the group name that is in the script is wrong or doesnot mach the SAMAccountName of the group you are trying to check....
    Yaniv Feldman
    Microsoft Security Regional Director
    Microsoft Management Expert
    MCSA, MCSE, MCT

    Comment


    • #3
      Well i just ran the script on my PC and it worked fine. Do you have the latest version of the Windows Scripting Host installed (v5.6)?
      Server 2000 MCP
      Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

      ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

      Comment


      • #4
        If the domain is still NT4 this script will fail.

        Comment


        • #5
          Hmmm funny, did he say it was NT4? I thought he said it was 2003 and tested from a Win2k workstation? What OS are you trying this script on?
          Server 2000 MCP
          Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

          ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

          Comment


          • #6
            He said W2003 server, but did not mention the domain... just a thought.

            Comment

            Working...
            X