Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

logon script does not work !!

  • Filter
  • Time
  • Show
Clear All
new posts

  • logon script does not work !!

    I have one server 2003 with AD
    and a logon script ( it worked good in win2000 server !! )
    when i run it on server 2003 or client 98 - XP (member of server 2003) it not work exactly
    please see the code below :

    ' sample logon script
    ' first let's create the objects we'll be using
    dim objNetwork
    set objNetwork = WScript.CreateObject("WScript.Network")
    dim strDomain, strUser 
    strUser = ""
    on error resume next
    strUser = objNetwork.UserName
    objNetwork.MapNetworkDrive "G:", "\\mountech-srv1\" & strUser
    'map network drive for user rely on the group
    if IsMember("CAD") then
     objNetwork.MapNetworkDrive "H:", "\\mountech-srv1\CAD"
    end if
    if (UCase(strUser)="hoang.tran" or UCase(strUser)="minh-nhut.bui" or UCase(strUser)="SUPERVISOR") then
      objNetwork.MapNetworkDrive "H:", "\\mountech-srv1\mountech"
    end if
    'TODO: may be change disk drive
    if UCase(strUser) = "T_HUONG" then
     objNetwork.MapNetworkDrive "h:", "\\mountech-srv1\t_huong_1"
    end if
    'Function determine whether a user is member of the group name strGroupName
    Function IsMember(strGroupName)
    dim objAdmins, user
    IsMember = False
    set objAdmins = GetObject("Windows://mountech" & strGroupName) 
    for each user in objAdmins.members
      if (UCase( = UCase(strUser)) then
        IsMember = True
        exit function
      end if
    End Function
    when server or client run the script with difference usernames (member of diifference gruop ) the script map the same network drive
    i guess i wrong in the path Windows://mountech" & strGroupName
    it work good in win 2000 with the path WinNT://mountech" & strGroupName

    domain name is
    please show me the solution for this problem!

    thanks you very much and best regards

    i've edited you're post to make it more readable...
    Last edited by Dumber; 23rd January 2006, 12:51.

  • #2
    Re: logon script does not work !!

    I would use LDAP:// instead of Windows:// .

    For example, use this syntax:



    • #3
      Re: logon script does not work !!

      And another thing ... Why do you compare an UCase with a lower-case string ?