Announcement

Collapse
No announcement yet.

Deleting of all permissions for access to network resources

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

  • Deleting of all permissions for access to network resources

    HI

    With Windows 7 SP1, how can I delete all permissions for access to network resources so that, when I go back to them, Windows asks me again to insert the various Login?

    THANKS

    BYE
    Last edited by balubeto; 1st June 2012, 18:14.
    balubeto

  • #2
    Re: Deleting of all permissions for access to network resources

    run the command below (this you can also run as login script when a user logs on):
    Code:
    cmdkey.exe /d:targetname
    targetname should match the target name exact how it was saved i.e. when the netbiosname of the target was used then use the netbiosname in the command, if the full dns name was used use that name, or if ip address was used then fillin the ip addres.
    To show a list run: cmdkey.exe /list

    Or you can create a shortcut that opens the stored user names & passwords window and delete it from there:
    rundll32.exe keymgr.dll, KRShowKeyMgr


    /Rems
    Last edited by Rems; 1st June 2012, 19:15.

    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: Deleting of all permissions for access to network resources

      Originally posted by Rems View Post
      run the command below (this you can also run as login script when a user logs on):
      Code:
      cmdkey.exe /d:targetname
      targetname should match the target name exact how it was saved i.e. when the netbiosname of the target was used then use the netbiosname in the command, if the full dns name was used use that name, or if ip address was used then fillin the ip addres.
      To show a list run: cmdkey.exe /list

      Or you can create a shortcut that opens the stored user names & passwords window and delete it from there:
      rundll32.exe keymgr.dll, KRShowKeyMgr


      /Rems
      These commands can be running on every user account?

      By chance, these commands is also valid for XP Pro SP3? If not, what is the command for this OS?

      THANKS

      BYE
      balubeto

      Comment


      • #4
        Re: Deleting of all permissions for access to network resources

        Originally posted by balubeto View Post
        By chance, these commands is also valid for XP Pro SP3? If not, what is the command for this OS?
        cmdkey.exe isn’t shipped with Windows XP but you can copy the exe file from a Windows server 2003 to a XP computer. The version shipped with Windows 7 64-bit does not run on Windows XP. (If you do not have Server 2003, download SP2 for server 2003 and extract the file from it.)

        Regular users can execute cmdkey to add or delete their own entries.


        _
        If you like to provide only a part of the target name(s) you can use the command below (not fully tested it yet),
        Code:
        ::Windows XP
        for /f "tokens=* delims=:" %%* in ('cmdkey.exe /list^|find.exe /i "targ"') do @cmdkey.exe /delete:%%*
        
        ::Windows 7
        for /f "tokens=* delims=:" %%* in ('cmdkey.exe /list^|findstr.exe /ri "target=.*targ"') do for /f "tokens=2 delims==" %%! in ('echo.%%*') do cmdkey.exe /delete:%%!

        You don't have to copy cmdkey.exe to all windows xp computers, you can execute cmdkey.exe over the network. Therefore you copy the win2003 cmdkey file to the script's folder (the share should be a trusted Zone to allow excuting the file).

        To determine the OS before executing cmdkey (to know if the script should use the local exe file or the one on the network) you can do something like,
        Code:
        @echo off
        
        VER.exe | findstr.exe /R " 5\.[0-2]\." &&(
           echo.Windows XP
           Set "cmdkey=%~0\..\cmdkey.exe"
        )||(
           echo.Windows 7
           set "cmdkey=cmdkey.exe"
        )
        
        echo Use:  "%cmdkey%" /delete:...
        (assuming the cmdkey exe file to be used for WinXP is in the script's folder)

        /Rems
        Last edited by Rems; 2nd June 2012, 13:25.

        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: Deleting of all permissions for access to network resources

          With Windows 7 SP1, as I do to eliminate, from the Windows registry, all the references to the computers no longer connected to the network?

          THANKS

          BYE
          Last edited by balubeto; 2nd June 2012, 10:41.
          balubeto

          Comment


          • #6
            Re: Deleting of all permissions for access to network resources

            Originally posted by balubeto View Post
            With Windows 7 SP1, as I do to eliminate, from the Windows registry, all the references to the computers no longer connected to the network?

            THANKS

            BYE
            You mean deleting all persistent driveletter mappings by removing all the subkeys from "HKEY_CURRENT_USER\Network\"?
            It is recommende to use net.exe use commands if you use a batch or command prompt to control drive mappings:

            Net.exe Use DrvLtr: /Delete /Yes

            Or, to delete all persistent and current mappings,
            Net.exe Use * /d /y

            But this will not erase the stored password for the target. The targetname and user combination is saved on a protected place and can only be programatically deleted using cmdkey.exe if using a batch or command prompt. If the username and target names are not deleted from there it will be used also for new connections to the target.


            If mappings are created by logon script you don't want it to be persistent mappings. To be sure the connection will not be remembered use the /PERSISTENT:NO switch for mapping the drive:
            NET USE Z: "\\SERVER_NAME\share_Name" /P:NO


            /Rems
            Last edited by Rems; 2nd June 2012, 12:15.

            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

            Working...
            X