Announcement

Collapse
No announcement yet.

NET USE script

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

  • NET USE script

    I want to create a GPO with a logonscript that mounts all my shared folders on my fileserver (NAM) to all my Organization Units in my domain tree.
    I have created a bat file called "logon" and I know that I am suppose to use NET USE R: \\srv08-dc\NAM\ /PERSISTENT: YES or NO
    Can someone give me guidance how to do this properly? Thanks

  • #2
    Re: NET USE script

    GPO's don't apply to OU's. GPO's apply to the objects in the OU's to which the GPO is linked. Is it the case that you want this logon script to apply to all users in the domain? If so, then link the GPO to the domain.

    Comment


    • #3
      Re: NET USE script

      Yes that is what I want, but i need help with the script, how should I type the NET USE script?

      Comment


      • #4
        Re: NET USE script

        If you want to map a drive for everyone then you can create a GPO and link it to the domain as "joeqwerty" said.

        However if you want to use NET USE and map different drives for different OU then you would have to create separate GPO's and link them to each OU as required.

        I would recommend looking at using VBScript instead of the NET USE command and using groups to map the drives this would be easier to manage and give you more flexibility.

        Let me know if you want some example login scripts that map network drives using VBScript.

        Comment


        • #5
          Re: NET USE script

          If its available to you then I would look into using group policy preferences to map network drives.

          http://blogs.technet.com/b/askds/arc...embership.aspx

          but for your user logon script you can just use something like:

          REM Mapping network drives.
          net use /persistent:yes
          net use K: \\server\share

          If the persistent switch it set then the drive mapping will survive a reboot.
          But if it's not set then the policy will map the script each time the user logs on anyway.
          Hope this helps.
          Please remember to award reputation points if you have received good advice.
          I do tend to think 'outside the box' so others may not always share the same views.

          MCITP -W7,
          MCSA+Messaging, CCENT, ICND2 slowly getting around to.

          Comment


          • #6
            Re: NET USE script

            Thanks guys, yea sure 8bit show me some VBscript examples

            Comment


            • #7
              Re: NET USE script

              Originally posted by uk_network View Post
              If its available to you then I would look into using group policy preferences to map network drives.
              I ditto this. Using group policy preferences would be easier to manage than a script, regardless if it's batch, vbs, or powershell. Since this was posted in the Server 2008/R2 forum I assume you have Server 2008 or newer in which case you should be able to manage group policy preferences easily. (it can be done even if you don't have 2008 or new though)

              Note that if you have Windows XP/2003 in your environment you will need install the Group Policy Preferences Client Side Extension update. https://www.google.com/search?q=grou...hrome&ie=UTF-8
              Regards,
              Jeremy

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

              Comment


              • #8
                Re: NET USE script

                uk_network, I copied what you said:

                REM Mapping network drives.
                net use /persistent:yes
                net use K: \\srv08\nam

                when I try to run the script it tells me that the network name could not be found. I havent done any GPO yet, just trying to get the scrpit it self to run by clicking om it manually.What do i do wrong ? nam is my shared fileserver, srv08 is my server name
                Last edited by skvimp; 8th December 2012, 17:42.

                Comment


                • #9
                  Re: NET USE script

                  If nam is the file server, you should be typing \\nam\sharename (where sharename is a valid share
                  Tom Jones
                  MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
                  PhD, MSc, FIAP, MIITT
                  IT Trainer / Consultant
                  Ossian Ltd
                  Scotland

                  ** Remember to give credit where credit is due and leave reputation points where appropriate **

                  Comment


                  • #10
                    Re: NET USE script

                    Ossian, if I type \\nam\sharename where should I type my servername? and my sharename is E right? because nam is on E

                    Comment


                    • #11
                      Re: NET USE script

                      I think you misunderstood.

                      If the server name is SERVER and the share name is SHARE then you would type:

                      \\SERVER\SHARE

                      The drive is irrelevant.

                      Comment


                      • #12
                        Re: NET USE script

                        Thanks, Joe -- I was thrown by "nam is the shared fileserver" above
                        Tom Jones
                        MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
                        PhD, MSc, FIAP, MIITT
                        IT Trainer / Consultant
                        Ossian Ltd
                        Scotland

                        ** Remember to give credit where credit is due and leave reputation points where appropriate **

                        Comment

                        Working...
                        X