basic script from ms but doesnt work

Home Forums Scripting Windows Script Host basic script from ms but doesnt work

This topic contains 5 replies, has 4 voices, and was last updated by Avatar wkasdo 15 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Avatar

    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:”, “\nemesishome” & 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:”, “\nemesistyping”

    ElseIf InStr(strGroups, FINANCE_GROUP) Then

    wshNetwork.MapNetworkDrive “g:”, “\FileServerFinance”
    wshNetwork.AddWindowsPrinterConnection “\PrintServerFinLaser”
    wshNetWork.SetDefaultPrinter “\PrintServerFinLaser”

    ElseIf InStr(strGroups, HUMAN_RESOURCES_GROUP) Then

    wshNetwork.MapNetworkDrive “g:”, “\FileServerHuman Resources”
    wshNetwork.AddWindowsPrinterConnection “\PrintServerHrLaser”
    wshNetWork.SetDefaultPrinter “\PrintServerHrLaser”

    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


    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….


    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)?


    If the domain is still NT4 this script will fail.


    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?


    He said W2003 server, but did not mention the domain… just a thought.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.