Announcement

Collapse
No announcement yet.

Windows 2000 - logon script- map to nearest server?

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

  • Windows 2000 - logon script- map to nearest server?

    I have a windows 2000 domain with multiple sites.

    Each site has its own logon script ie logon.bat which maps drives to that sites server shares.
    i.e net use i: \\server1\apps

    The users in each site are tied to there respective logon scripts via active directory.

    The problem is if a user from site1 travels to site2 and logs on they recieve mappings for a server that is not local to them and apps will not run.

    My question is if there is a way to map a drive using the net use command to the nearest server, maybe something like ..
    net use \\%localserver\apps ?

    Thanks

  • #2
    Re: Windows 2000 - logon script- map to nearest server?

    You could try net use Drive_Letter %LOGONSERVER%\apps

    This will map the drive to the server the users is currently loggeed on to.

    Comment


    • #3
      Re: Windows 2000 - logon script- map to nearest server?

      Originally posted by wullieb1
      You could try net use Drive_Letter %LOGONSERVER%\apps

      This will map the drive to the server the users is currently loggeed on to.
      This will work most of the time but there will be the odd occasion when the user maybe authenticated by a server on another site should there be a busy period for the local server.

      To be honest i would take the very small risk and do it the way wullieb has suggested.
      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
        Re: Windows 2000 - logon script- map to nearest server?

        Thanks, however

        there are some sites that have more than 1 domain controller

        ie \\appserver1, \\mailserver1

        The mail server might authenticate them but there is no apps share on the mail server


        A separate but related issue would be that I seemed to have observed in the past where users, while logging on, will randomly authenticate to a domain controller that is not local to them. I have no idea why this occurs.

        Thanks

        Comment


        • #5
          Re: Windows 2000 - logon script- map to nearest server?

          You could use the choice command (needs to be downloaded) and have the logon script ask the question "Which site are you on?" and then by pressing 1,2 or 3 it will map the appropriate drive...

          Bit messy but would work.
          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
            Re: Windows 2000 - logon script- map to nearest server?

            yes, a bit messy......especially with over 30 sites.

            Thanks

            Comment


            • #7
              Re: Windows 2000 - logon script- map to nearest server?

              Originally posted by tonyyeb
              This will work most of the time but there will be the odd occasion when the user maybe authenticated by a server on another site should there be a busy period for the local server.

              To be honest i would take the very small risk and do it the way wullieb has suggested.
              Never thought of that. Opps me bad.

              Anyway back to the problem at hand.

              Now it gets complicated. As has been suggested you could download choice.exe and write a script that would ask a user which site they are on. This is a bit risky because it requires user input and we all know what users are like.

              You could try using something by the IP address of the machine logged on. This would allw you to have ascript that checked the IP Address when a user logs on then map the drive accordingly.

              Comment


              • #8
                Re: Windows 2000 - logon script- map to nearest server?

                Originally posted by armstrongtj
                yes, a bit messy......especially with over 30 sites.

                Thanks
                Ouch! Yes and choice only allows 9 choices!

                Do you subnet your sites?
                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


                • #9
                  Re: Windows 2000 - logon script- map to nearest server?

                  Originally posted by wullieb1
                  You could try using something by the IP address of the machine logged on. This would allw you to have ascript that checked the IP Address when a user logs on then map the drive accordingly.
                  Yup! Thats where is was going with my question... but as we posted at almost the same time...!
                  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


                  • #10
                    Re: Windows 2000 - logon script- map to nearest server?

                    Great minds think alike

                    Comment


                    • #11
                      Re: Windows 2000 - logon script- map to nearest server?

                      whats you AD structure like. are you users in different sites all in different OU's or secuirty groups. if so you can use their ou or secuirty group memeberships to determine what server they get.
                      MCSE 2000\2003, A+
                      00000001-00000011-00000011-00000111

                      Comment


                      • #12
                        Re: Windows 2000 - logon script- map to nearest server?

                        Originally posted by pcking999
                        whats you AD structure like. are you users in different sites all in different OU's or secuirty groups. if so you can use their ou or secuirty group memeberships to determine what server they get.
                        Yep this is also an option but as he has already stated users will move around from one site to the next whilst not changing there group memberships will not help them if they are trying to access a different server other than the one on-site.

                        For me the easiest option wold be to run a script that checked the IP address given by DHCP then map the drive to the server that matches that range.

                        Comment


                        • #13
                          Re: Windows 2000 - logon script- map to nearest server?

                          Thanks for your input...

                          Yes each site has its own ou. The employees that work out of that site are in that ou.

                          There is no ou for roaming users.


                          Each site does have its own subnet i.e. 172.17.1.100, 172.17.13.100, etc ..

                          I like the idea of the script checking the ip address, (all workstations use dhcp of course) but I just don't know how to create this particular type of script so I was wondering if someone could post an example. Also is it possible to do this while keeping the logon scripts as .bat files and not changing to .vbs?

                          Comment


                          • #14
                            Re: Windows 2000 - logon script- map to nearest server?

                            If it is only the users that roam, and not the machines, you could set an environment variable that points to the local server, or a small batch file stored on the machine that you could call from inside your main batch file to do the site specific parts of the script. Those could be applied to the machines by group policy since the machines will be in fixed groups. It will not help for laptops, but I have used the technique to differentiate machines before now

                            Comment


                            • #15
                              Re: Windows 2000 - logon script- map to nearest server?

                              I know this thread is long dead, but the challenge caught my interest, so here goes, the following script, run as a batch file will find the IP address of the current machine, split it into its 4 parts as per normal IP address notation, and set variables in the script that can be used in your logic to select actions

                              Code:
                              for /f "skip=1 tokens=1,2 delims=[]" %%a in ('ping -n 1 %computername%') Do if "%%b" NEQ "" CALL :dedot %%b
                              echo *%oct1%*%oct2%*%oct3%*%oct4%*
                              
                              
                              ::Your Script Here
                              
                              
                              
                              Goto :EOF
                              :dedot
                              FOR /f "tokens=1-4 delims=." %%a in ("%1") do set oct1=%%a& set oct2=%%b& set oct3=%%c& set oct4=%%d
                              
                              Goto :EOF
                              So, for example a machine with IP address 192.168.13.3 would have the following results

                              oct1 would be 192
                              oct2 would be 168
                              oct3 would be 13
                              oct4 would be 3

                              it will fall apart if you are not on an IP based network, and probably if you are using IP v6
                              Hows that?

                              Comment

                              Working...
                              X