none
how to delete cached ssh host keys from registry with powershell RRS feed

  • Question

  • I need help with deleting cached ssh host keys for a specific target from the registry with PowerShell.

    I tried finding the required key with this command

    Get-ItemProperty HKCU:\Software\SimonTatham\PuTTY\SshHostKeys\  | Select-String target_address

    it didn't work. it returns all the content keys of ssh host keys. My friend told me that all of the sshhostkeys key is a single string.

    i tried :

    Get-ItemProperty HKCU:\Software\SimonTatham\PuTTY\SshHostKeys\ |findstr target_address

    it worked, but i am not able to pipe the output of this command to delete it.


     


    • Edited by gaurshak Monday, May 20, 2019 7:50 AM error
    Monday, May 20, 2019 7:49 AM

All replies

  • To change the registry you have to use "Set-ItemProperty".  To alter a string you have to get the string and edit it then use the "set" to write the results back.

    To learn how to use PowerShell you can use the help to read about the registry provider.  Search the net foe examples of how to do what you are trying to do.

    To get the string use this:

    $sshkeys = (Get-ItemProperty HKCU:\Software\SimonTatham\PuTTY\SshHostKeys).target_address

    help registry

    Always consult help for all commands you are trying to use and learn.  It is the first step to solving any PS problem.


    \_(ツ)_/

    Monday, May 20, 2019 6:34 PM
    Moderator
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee


    Just do it.

    Monday, June 3, 2019 7:45 AM
    Moderator