Announcement

Collapse
No announcement yet.

Desperately Seeking Remco, when only the best will do.

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

  • Desperately Seeking Remco, when only the best will do.

    Sorry, not much of a title description for the script that I need.

    User's Home Drive is mapped via the ADUC User Account, Profile tab. However due to an issue with AD the Home Drive is not being mapped. The path to the Home Folder is:

    \\server\SHARE\year\username and I don't know how to script this with the "year" part of the path causing me a problem. I tried /home but that didn't work and I haven't had time to look up why so I am doing the lazy and hoping someone can point a script in my direction.

    Thanks.
    1 1 was a racehorse.
    2 2 was 1 2.
    1 1 1 1 race 1 day,
    2 2 1 1 2

  • #2
    Re: Desperately Seeking Remco, when only the best will do.

    Maybe a stupid question, but why's the year important?
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      Re: Desperately Seeking Remco, when only the best will do.

      It keeps the Students work all in one Folder so when the leave then only have to delete a single folder and not go looking for individual User Folders. It is setup the same way in AD. Again we can just delete the whole Year level. In December, Year 2013 in AD and under the SHARE get deleted. Creates room for the next year coming through. I'll get a screenshot of the structure when I am there in Thursday so you can see what I mean. I'm sure you will appreciate a picture = 1,000 words.

      Never mind about the script as I have thought of a Q & D way of getting it running temporarily. Going to SHARE the Year and then create individual Logon Scripts for each year. Should only take about 5 minutes to do.

      Script would then be net use h: \\server\YEAR$\%usename%

      It doesn't pay to post when you are really tired as you miss seeing the obvious.
      1 1 was a racehorse.
      2 2 was 1 2.
      1 1 1 1 race 1 day,
      2 2 1 1 2

      Comment


      • #4
        Re: Desperately Seeking Remco, when only the best will do.

        So what's the difference between

        Code:
        net use h: \\server\year$\%username%
        and
        Code:
        net use h: \\server\share$\year\%username%
        Both should work just fine.

        The net use <drive letter> /home only works if the home drive is specified in the user properties in AD.
        Regards,
        Jeremy

        Network Consultant/Engineer
        Baltimore - Washington area and beyond
        www.gma-cpa.com

        Comment


        • #5
          Re: Desperately Seeking Remco, when only the best will do.

          Originally posted by Jeremy
          net use <drive letter> /home*only works if the home drive is specified in the user properties in AD.
          Thats the problem. It is specified it the AD Properties Profile tab.

          The problem with the "year" in the script path is there are seven different years that are used to group the school students. The year folder it to make it easier to remove their data when the student "graduates" and departs the scene. Same structure is used for their accounts in AD and again that year level can be removed from AD very efficiently come end of school year. One enterprising tech has written an app that takes a csv file generated from the school administration software and we use that to create all the new user accounts, their passwords and thier Home Folders (and a few other things (damn, typing on a tablet is a pain) in one hit). With having the "year" in a drive mapping script, it would need to be a variable and I have no idea how to do it. It would need to relate to the Year OU that the user is in. My Q&D option just means I have to create 7 Year SHARES and 7 logon.bat files. One for each year. Temp solution plus its a quick fix and gets the Principal off my back (this drive map has been a world ending disaster from the way he has hassled me about it) while I concentrate on fixing the root cause of all this and not get distracted by that minor issue.
          1 1 was a racehorse.
          2 2 was 1 2.
          1 1 1 1 race 1 day,
          2 2 1 1 2

          Comment


          • #6
            Re: Desperately Seeking Remco, when only the best will do.

            Ah, I see. So you're looking to pull the year info out of AD and map a drive based on the OU.

            Definitely doable. But what environment do you have? 2008 AD? Windows 7? If so it might be a better option to use group policy preferences to map the drive using item level targeting instead of scripting the process. The users will need to be a part of a user group for their respective year.

            Otherwise we could look at doing a script when yo have the time.
            Regards,
            Jeremy

            Network Consultant/Engineer
            Baltimore - Washington area and beyond
            www.gma-cpa.com

            Comment


            • #7
              Re: Desperately Seeking Remco, when only the best will do.

              Had the same problem at a school I was working at a few month ago!

              Enjoy!

              Code:
              HomeDirectory
              
              Function HomeDirectory()
                On Error Resume Next   
                 
                 Set objTrans   =   CreateObject("NameTranslate")
                 Set objNetwork   =   CreateObject("WScript.Network")
                 Set objFSO      =   CreateObject("Scripting.FileSystemObject")
                 
                 strUserName = objNetwork.UserName
                 strUserDomain = objNetwork.UserDomain
                 
                 objTrans.Set 3, strUserDomain & "\" & strUserName
                 strUserDN   =   UCase(objTrans.Get(1))
                 Set objUser   =   GetObject("LDAP://" & strUserDN)
                 strHomeDrive   =   objUser.HomeDrive
                 strHomePath      =   objUser.HomeDirectory
                 
                 If strHomePath <> "" Then objNetwork.MapNetworkDrive strHomeDrive, strHomePath
              
              End Function
              * Shamelessly mentioning "Don't forget to add reputation!"

              Comment


              • #8
                Re: Desperately Seeking Remco, when only the best will do.

                Originally posted by JeremyW
                But what environment do you have? 2008 AD? Windows 7?
                Holy falling Dropbears Batman I forgot essential info. Sorry Jeremy. Server 2008 R2 SP1, Windows 7 SP1 x32.

                Still haven't figured out why AD isn't publishing the Home Folder. Even mapping them in a GPO wasn't working and right now I am actually in debit for time at that place so the Q & D method will have to do for a while.

                Thanks Topper. Will try this next Term and see what happens. Did you figure out why your drives weren't picking it up from the AD Profile?

                Also, you are mistaken. There are 11 types of people in this world, those who understand binary, those who do not and those who don't care.
                1 1 was a racehorse.
                2 2 was 1 2.
                1 1 1 1 race 1 day,
                2 2 1 1 2

                Comment


                • #9
                  Re: Desperately Seeking Remco, when only the best will do.

                  Ha ha, very true, need to change that, it's 6+ years old!

                  The reason I found was down to an offline files setting if I remember correctly, guess you're going to tell me that you don't even have offline files setup now! :-p
                  * Shamelessly mentioning "Don't forget to add reputation!"

                  Comment


                  • #10
                    Re: Desperately Seeking Remco, when only the best will do.

                    Can you actually map the drive succesfully if the user would do it manually or when using a logon script or your Q&D way?
                    and using the exact same server name (nb name or fqdn / DFS) and the same drive letter for it as has been configured in AD?


                    If AD is not publishing the home folder path, the user will have just the two default variables,
                    HOMEDRIVE=C:
                    HOMEPATH=\Users\<username>

                    in its user environment.

                    If the home folder in AD is published the users have these three variables,
                    HOMEDRIVE=H:
                    HOMEPATH=\
                    HOMESHARE=\\server\share\year\<username>



                    Can you verify all three 'HOME...' variables exist and the values are valid.


                    btw.
                    Welcome Topper good to see you again!


                    /Rems
                    Last edited by Rems; 5th September 2013, 16:12.

                    This posting is provided "AS IS" with no warranties, and confers no rights.

                    __________________

                    ** Remember to give credit where credit's due **
                    and leave Reputation Points for meaningful posts

                    Comment


                    • #11
                      Re: Desperately Seeking Remco, when only the best will do.

                      I did it the Q&D way as it took 5 minutes and unfortunately I didn't have the time to diagnose what the actual issue was. If I am still there next year the Domain will be blown away and built clean. AD is carrying a lot of baggage and I think that is the better option at this point in time. It means I should have Server 2012 R2 and all the nice goodies that it contains. Pushing a GPO from the AD Server is my favourite so far.

                      No Topper, no offline files.
                      1 1 was a racehorse.
                      2 2 was 1 2.
                      1 1 1 1 race 1 day,
                      2 2 1 1 2

                      Comment

                      Working...
                      X