How to make a logon script, that maps network drives ???
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 18

Thread: How to make a logon script, that maps network drives ???

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    11

    Question How to make a logon script, that maps network drives ???

    We just installed a Windows 2003 server, and are having alot of trouble getting a logon script to work.

    We have read the help files, and done what they say, but it still doesn nothing when trying to login to the server.

    It will log us in, and let us in the apropriate files, but I dont think the script is wroking, or running at all.
    Becuase it is not mapping the network drives and folders, as we told it to.

    Please tell me how to write a simple script to map drives and folders at logon, and how to make it run.

    Thanks alot.

  2. #2
    Registered User
    Join Date
    Apr 2004
    Posts
    11
    Here is the script that we are trying to use.


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

    Set wshNetwork = CreateObject("WScript.Network")
    wshNetwork.MapNetworkDrive "G:", "\\test_share" & wshNetwork.UserName

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

    If InStr(strGroups, ENGINEERING_GROUP) Then

    wshNetwork.MapNetworkDrive "L:", "\\R Folder"

    end if

  3. #3
    Tech-To-Tech Mod kato2274's Avatar
    Join Date
    Sep 2001
    Location
    Bentleyville, Pa
    Posts
    2,317
    it's pretty simple. what have you already done? if you can detail what you tried it will make things a lot easier.

    but basically the script is just a batch file that utilizes net use commands

    i.e.

    net use z: \\server\share

    and you execute it from the user properties in active directory users and computers. under the profile tab there is a place to specify a logon script.

    you must be sure to have the permissions set correctly on the shares so that when you are mapping a share to a drive for a user he/she actually has permissions to use the resource.
    Last edited by kato2274; April 29th, 2004 at 06:05 PM.
    Nonsense prevails, modesty fails
    Grace and virtue turn into stupidity - E. Costello

  4. #4
    Tech-To-Tech Mod kato2274's Avatar
    Join Date
    Sep 2001
    Location
    Bentleyville, Pa
    Posts
    2,317
    Quote Originally Posted by jtice
    Here is the script that we are trying to use.


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

    Set wshNetwork = CreateObject("WScript.Network")
    wshNetwork.MapNetworkDrive "G:", "\\test_share" & wshNetwork.UserName

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

    If InStr(strGroups, ENGINEERING_GROUP) Then

    wshNetwork.MapNetworkDrive "L:", "\\R Folder"

    end if
    if this running server side or client side? this would be SO much easier to do via active directory users and computers

    example:
    in profiles of engineering group set a logon script of engine.bat

    the engine.bat has the command
    net use L: \\server\share

    for the user specific maps, the %username% variable works in a batch script
    ie.
    net use Z: \\server\home\%username%
    Last edited by kato2274; April 29th, 2004 at 06:05 PM.
    Nonsense prevails, modesty fails
    Grace and virtue turn into stupidity - E. Costello

  5. #5
    Registered User
    Join Date
    Apr 2004
    Posts
    11
    I have tried placing the script in the user part, and under the startup/shutdown parts.

    I actually placed the script in EVERY place I could see that you could put a script.

    We need this to be a global script, not one that is placed in each users profile. That would take more time to do.

    This needs to be a script that is ran when ever ANYone logs in.
    Then that script looks to see who logged in, and what drive is supposed to be mapped to them.

    When we goto login, it basically does nothing, acts like the script isnt even there.

  6. #6
    Registered User
    Join Date
    Apr 2004
    Posts
    11
    I dont see where I can assign a script to a group.
    I went to properties of the group, as I would a user, and I dont see anythign about it there.

    If I goto a users properties, I see where I can add a script.
    But not for a group.

  7. #7
    Tech-To-Tech Mod kato2274's Avatar
    Join Date
    Sep 2001
    Location
    Bentleyville, Pa
    Posts
    2,317
    Quote Originally Posted by jtice
    I dont see where I can assign a script to a group.
    I went to properties of the group, as I would a user, and I dont see anythign about it there.

    If I goto a users properties, I see where I can add a script.
    But not for a group.
    you're right. I got ahead of myself. what I usually do is setup one user for a group. then just copy that user when I need another user in that group. gives them the same properties. ......I was just thinking of it this way because we have group logon scipts.....i.e. development.bat etc. they aren't actually applied in the group properties, but they are applied to the group when creating a new user and I copy an existing development group user
    Nonsense prevails, modesty fails
    Grace and virtue turn into stupidity - E. Costello

  8. #8
    Registered User
    Join Date
    Apr 2004
    Posts
    11
    Quote Originally Posted by kato2274
    you're right. I got ahead of myself. what I usually do is setup one user for a group. then just copy that user when I need another user in that group. gives them the same properties. ......I was just thinking of it this way because we have group logon scipts.....i.e. development.bat etc. they aren't actually applied in the group properties, but they are applied to the group when creating a new user and I copy an existing development group user
    Ah I see what you are doing.
    So, there is no way to assign a script to a group?
    Shouldnt there be a way to make a script run when ANYone logs in?
    And that script map drives according to who that user is?

    I also went to a users profile, and told it to use this script, but it still didnt do anything.

    Also, your are mentioning a .bat file, not a .vbs script file, could that be part of it? Or can they both work?

  9. #9
    Tech-To-Tech Mod kato2274's Avatar
    Join Date
    Sep 2001
    Location
    Bentleyville, Pa
    Posts
    2,317
    Quote Originally Posted by jtice
    Ah I see what you are doing.
    So, there is no way to assign a script to a group?
    Shouldnt there be a way to make a script run when ANYone logs in?
    And that script map drives according to who that user is?

    I also went to a users profile, and told it to use this script, but it still didnt do anything.

    Also, your are mentioning a .bat file, not a .vbs script file, could that be part of it? Or can they both work?
    vbs scripts should work. have you tried instead of setting the script in users profiles to setting it in the domain group policy. this may be the way to get it to work. try under user configuration - administrative templates - logon - run these programs at user logon setting. set the permissions to everyone.

    again . . . . not the way I'd do it. . . . . but this seems viable and may be your answer.
    Last edited by kato2274; April 29th, 2004 at 11:37 AM.
    Nonsense prevails, modesty fails
    Grace and virtue turn into stupidity - E. Costello

  10. #10
    Tech-To-Tech Mod kato2274's Avatar
    Join Date
    Sep 2001
    Location
    Bentleyville, Pa
    Posts
    2,317
    the script works fine. I ran it on my local machine. (had to change shares and groups and such) but it works just fine.

    I would try the group policy approach. I think it should work and would keep it on the server side so that even if someone brings a laptop in and logs onto the domain, the script executes......let me know if it works. I'm curious....but I'm not going to apply it to our production domain
    Nonsense prevails, modesty fails
    Grace and virtue turn into stupidity - E. Costello

  11. #11
    Registered User
    Join Date
    Apr 2004
    Posts
    11
    Quote Originally Posted by kato2274
    the script works fine. I ran it on my local machine. (had to change shares and groups and such) but it works just fine.

    I would try the group policy approach. I think it should work and would keep it on the server side so that even if someone brings a laptop in and logs onto the domain, the script executes......let me know if it works. I'm curious....but I'm not going to apply it to our production domain

    I must be missing something.

    I tries everything you said, nothing is mapping the drives.

    I even tried your .bat file.
    all it has in the command:
    use net L \\server1\R Folder

    server1 is the name of our server
    R Folder is the name of the folder I want to map.

    I dont get any error messages at all during logon either.

    I went to Group Policy Editor > User Config > Admin Templates > System > Logon > Run these programs at user Logon

  12. #12
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824

    I even tried your .bat file.
    all it has in the command:
    use net L \\server1\R Folder


    net use L: .....
    Never, ever approach a computer saying or even thinking "I will just do this quickly."

  13. #13
    Registered User
    Join Date
    Apr 2004
    Posts
    11
    Quote Originally Posted by NooNoo
    net use L: .....

    Heh, yea, i noticed that.
    Still doesnt work.

    Is there maybe something that I dont have installed?
    Or a setting thats not right?

  14. #14
    Tech-To-Tech Mod kato2274's Avatar
    Join Date
    Sep 2001
    Location
    Bentleyville, Pa
    Posts
    2,317
    Quote Originally Posted by jtice
    Heh, yea, i noticed that.
    Still doesnt work.

    Is there maybe something that I dont have installed?
    Or a setting thats not right?
    OK you gotta attack this one piece at a time. run your script locally on a client machine and also try the net use commands from the local machine. if the script and net use commands work there then you can move to trying to deploy the scripts. if it doesn't you gotta find out why. forget logging in right now. just verify your commands, then worry about deploying them
    Nonsense prevails, modesty fails
    Grace and virtue turn into stupidity - E. Costello

  15. #15
    Registered User
    Join Date
    Apr 2004
    Posts
    11
    Quote Originally Posted by kato2274
    OK you gotta attack this one piece at a time. run your script locally on a client machine and also try the net use commands from the local machine. if the script and net use commands work there then you can move to trying to deploy the scripts. if it doesn't you gotta find out why. forget logging in right now. just verify your commands, then worry about deploying them

    I now know that
    net use Z: \\CompName\Folder
    Does work if ran on a machine locally.

    Now, there must be something either making the script not run, or the login itself not calling it up properly.

    What this is from, I do not know yet, i am betting some configurration i am missing.

Similar Threads

  1. [RESOLVED] 70-240: LETS DO THIS!!
    By 70-240 in forum Certification
    Replies: 14
    Last Post: February 20th, 2012, 03:35 AM
  2. create logon script to set IP address in IE
    By death in forum Networking
    Replies: 3
    Last Post: April 23rd, 2001, 09:40 PM
  3. [RESOLVED] W2K network logon
    By gmbruin in forum Windows NT/2000
    Replies: 4
    Last Post: March 22nd, 2001, 05:19 PM
  4. [RESOLVED] NT logon script
    By Note in forum Windows NT/2000
    Replies: 3
    Last Post: August 1st, 2000, 07:59 AM
  5. [RESOLVED] network logon skipped!
    By [email protected] in forum Windows 95/98/98SE/ME
    Replies: 1
    Last Post: April 13th, 2000, 12:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •