Announcement

Collapse
No announcement yet.

reading the usernames and passwords

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

  • reading the usernames and passwords

    hi

    my problem is that i was using a batch file to map the network drives for the domain users. the network drive was on the same DC.

    now i upgraded the storage on another server and i want to move all of the shared folders thier. a problem occures when running the batch file which is that it askes for the user name and password at every time the script is running.

    so now i was wondering are there any way to read the username and the password for the current user and pass it to the patch file? or i should use some kind of vbscript.. if so what is the fucnitions to read the authentication information for the users

    thank you

  • #2
    Re: reading the usernames and passwords

    Is the new server made a member server of the same domain as the dc?


    \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


    • #3
      Re: reading the usernames and passwords

      yes
      it's a member of the same domain

      Comment


      • #4
        Re: reading the usernames and passwords

        Can you show us the logon script you are currently using that map the drives for the users.


        \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


        • #5
          Re: reading the usernames and passwords

          net use * /y /d <----- to disconnect all the drives
          net use * \\servername\sharedfolder\folder1
          net use * \\servername\sharedfolder\folder2
          net use * \\servername\sharedfolder\folder3

          this was working ok when the shared folders was on the same DC
          but when i moved it to the new server which is a domain member it asks for the user name and password so i modify the script to

          net use * \\servername\sharedfolder\folder1 /USER:domain\%username%

          so at least users will only enter their password

          Comment


          • #6
            Re: reading the usernames and passwords

            What are the Share and NTFS permissions on the shared folder?

            Comment


            • #7
              Re: reading the usernames and passwords

              It looks if the script run before the user is fully authenticed. Perhaps the users using cached credential when they logon to their computer? Check the GPO policy "always wait for network at startup or logon".

              Also try this batch it will write a log:
              Code:
              @echo off
              Set cDir=%CD%
              
              > %temp%.\loginscript.log 2>&1 (
              echo\Authenticating DC:
              echo\%LOGONSERVER:~2%.%USERDNSDOMAIN%
              
              echo\
              Net.exe Use * /d /y
              
              echo\Connecting to server NewServer...
              rem # the next line will provide an outstanding network connection
              rem # to the new server.
              rem # NOTE- there should be no request for a user password!
              Net.exe Use "\\NewServer\IPC$" /PERSISTENT:NO /User:"%UserDOMAIN%\%UserName%"
              
              echo\Create new drive mappings
              PushD "\\NewServer\sharedfolder\folder1"
              echo\&echo\Done %CD%
              PushD "\\NewServer\sharedfolder\folder2"
              echo\&echo\Done %CD%
              PushD "\\NewServer\sharedfolder\folder3"
              echo\&echo\Done %CD%
              
              echo\
              Net.exe Use
              )
              
              cd /d %cDir%
              echo\&echo\&echo\
              start "" notepad.exe %temp%.\loginscript.log
              \Rems


              EDIT
              Check if there might be a wrong (old) password cached for the user on his/her computer, and that wrong password then possible is used to autenticate on the targed computer for mapping the drive: http://forums.petri.com/showthread.php?t=36691
              start / Run: rundll32.exe keymgr.dll, KRShowKeyMgr
              .
              Last edited by Rems; 30th May 2009, 09:53.

              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


              • #8
                Re: reading the usernames and passwords

                Code:
                echo\&echo\&echo\
                Remco, are the little squares in the code intentional? Being a script nuffie I don't know and I have not noticed them in any other scripts before. (Maybe more evidence of a mis-spent youth )
                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: reading the usernames and passwords

                  Originally posted by biggles77 View Post
                  Code:
                  echo\&echo\&echo\
                  Remco, are the little squares in the code intentional? Being a script nuffie I don't know and I have not noticed them in any other scripts before. (Maybe more evidence of a mis-spent youth )
                  The little square stands usually for a non-printing character or a empty characterplace in the font.

                  In this batch the little squares are BELL characters (ctrl+g), a device code used to sound an audible bell or tone (beep) in order to alert the user.

                  BELL code is one of the known Control characters for a device.

                  Beeps can be used to create checkpoints in a script that you run for testing (or, in this case it is used for reminder of the temporary modified logonscript).
                  You can copy this square -beep- character and @echo it in your own batches or vbscripts.

                  example how to use it in vbscript:
                  Code:
                        ' Sound 3x beeps (just for testing)
                        With CreateObject("WScript.Shell")
                           .Run "cmd /c @echo ",0,True
                           'or simply,
                           .Run "cmd /c @echo\" &chr(7),0,True
                           .Run "cmd /c @echo\" &chr(7),0,True
                        End With
                  This article shows how you can create the non-printing BEEP character yourself for copying purpose:
                  http://windowsitpro.com/article/arti...attention.html
                  Or,
                  you could also do it this way:
                  press key-combination WindowsButton+R to open the Run bar
                  Run:
                  cmd /c COPY CON %temp%\beep.bat
                  In the window enter: @echo\
                  and on the same line Push the buttons: Ctrl+G Ctrl+Z ( displays: @echo\^G^Z )
                  Press Enter to quit
                  For testing the tone:
                  Run: %temp%\beep.bat
                  For copying the code:
                  Run: notepad %temp%\beep.bat


                  \Rems
                  Last edited by Rems; 9th May 2009, 09:18.

                  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


                  • #10
                    Re: reading the usernames and passwords

                    hi

                    i tried to use the script but the same problem exist.

                    i can explain more:

                    there are a certain restriction for the shared folders
                    i mean for example i don't have any access privilages to folder1 but i have certain privilages for folder2

                    when the batch is running it maps the folder2 for me but when it reaches folder1 it asks for the my password so if i enter anything even false password it continues mapping and maps the folders that i have access to
                    it doesn't ask for the password anymore even that there are some folder that i don't have any access to

                    i searched alot and i think i will go with asking the users to enter thier password when the console screen asks them to

                    but i'm still welcoming any other solution

                    Comment


                    • #11
                      Re: reading the usernames and passwords

                      why do you want this?
                      why not map only the network drives the user has permissions for?

                      map the network drives on group memberships and everything is fine...

                      Comment

                      Working...
                      X