Announcement

Collapse
No announcement yet.

Map Drive Network

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

  • Map Drive Network

    Hi All

    I create Bat file but i need to check permission via user if user don't access to folder no display Drive if user have permission to access to folder can display.

    How to edit

    @echo off
    net use s: /delete /yes
    net use s: \\172.16.80.4\Public$
    net use p: /delete /yes
    net use p: \\172.16.80.4\PM /persistent:yes
    net use i: /delete /yes
    net use i: \\172.16.80.4\System_Support /persistent:yes

  • #2
    Re: Map Drive Network

    Can't think how to do it in a batch file but a slightly different way would be with KIXtart like this:
    IF INGROUP ("USERGROUP1")
    USE U: \\servername.\domain.local\share

    or you could use group policy which applies based on group membership.
    cheers
    Andy

    Please read this before you post:


    Quis custodiet ipsos custodes?

    Comment


    • #3
      Re: Map Drive Network

      Originally posted by AndyJG247 View Post
      Can't think how to do it in a batch file but a slightly different way would be with KIXtart like this:
      IF INGROUP ("USERGROUP1")
      USE U: \\servername.\domain.local\share

      or you could use group policy which applies based on group membership.
      I don't have permission on DC

      Comment


      • #4
        Re: Map Drive Network

        Why bother?
        If users do not have permission, they may see the drive but won't get into it

        (or ask your network admin to set things up on the domain for you)
        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


        • #5
          Re: Map Drive Network

          try this:
          Code:
          @echo off
          
          :: Disconnect drives
          for %%$ in (s: p: i:) do net.exe use %%$ /D /Y
          
          :: Map drives only if user has at least Read permissions there
          call:MapDrv s: "\\172.16.80.4\Public$" /P:N
          call:MapDrv p: "\\172.16.80.4\PM" /P:N
          call:MapDrv i: "\\172.16.80.4\System_Support" /P:N
          
          echo done....
          
          
          :end of batch
          GOTO:EOF ---- Map drive routine ----
             :MapDrv
             if exist "%~2\*" (net.exe use %*)
          exit /b 0
          /Rems

          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


          • #6
            Re: Map Drive Network

            what is the net.exe


            Originally posted by Rems View Post
            try this:
            Code:
            @echo off
             
            :: Disconnect drives
            for %%$ in (s: p: i:) do net.exe use %%$ /D /Y
             
            :: Map drives only if user has at least Read permissions there
            call:MapDrv s: "\\172.16.80.4\Public$" /P:N
            call:MapDrv p: "\\172.16.80.4\PM" /P:N
            call:MapDrv i: "\\172.16.80.4\System_Support" /P:N
             
            echo done....
             
             
            :end of batch
            GOTO:EOF ---- Map drive routine ----
               :MapDrv
               if exist "%~2\*" (net.exe use %*)
            exit /b 0
            /Rems

            Comment


            • #7
              Re: Map Drive Network

              Originally posted by momaydopod View Post
              what is the net.exe
              There is a very helpful, but apparently unknown, web site called
              You type in a question and it gives you a list of sites which can answer it.

              In your case (using exactly what you posted) there are 23 million results that took approximately 10 seconds to find.
              Here, I've saved you those 10 seconds of your life

              http://www.google.co.uk/#hl=en&sclie...w=1489&bih=799
              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