Is there a way to automatically clear clipboard after a paste?

Hi Folks,
Im looking for a way to programmatically clear the clipboard after a paste.
The use case is I have a password in there, used it once by pasting, but I do not want to have to do another action to remember to clear the clipboard.

Can you kind of cut it out of the clipboard so its cleared, as soon as you paste it, with powershell or .Net or something?

Thanks!

Of course you could use Set-Clipboard with a random value to overwrite the existing content of the clipboard but the actual question for me would be “Why is there a password in your clipboard?”.

The actual problem would be to get this process of clearing the clipboard from the password triggered. You could try to create a process where you already trigger the pasting by PowerShell.

Where did you copy the password from? All reasonable password managers should have functions for that.

I dont use a password manager at all. We have long passwords that get changed every month, so its a PITA to constantly come up with new ones and memorize them. I eventually get them memorized, but on day 1 or 2, not so much. I use the secret management/secret vault modules so I have the passwords in the vault.
For scripts, I can just call and use them when I need. But sometimes I want it in my clipboard to log into something, but I do not want to be sloppy and forget its in there, and then what might happen is I’m on some random conference call and accidently paste it etc…

I would like to copy it to clipboard, paste it and its gone.

Thanks

Why not?

Wow … every month? … Poor you. Did you know that periodic password changes are not recommended anymore? :wink:

I had a bad experience losing all of my passwords using a manager a few years ago, so stopped using them. I also see in the news these guys get hacked all the time.

I work for a large org…I guess they didn’t get the NIST memo yet lol…would be great to not have to deal with this stuff. We also have multiple accounts, which makes it worse.

I saw this on another forum:

This is why, when you exit an Office application, you will sometimes see a dialog along the lines of ‘There is a lot of information on the clipboard — do you want to keep it there or discard it?’ If you say ‘Keep it’, then the Office app sends all of the actual data to the clipboard in the usual way. If you say ‘Discard it’, then the Office app doesn’t do that, the clipboard IOU is deleted, and the clipboard is now clear.

That’s kind of what I’m trying to achieve.

Thanks,

Matt

Hmmm … so you have to monitor the clipboard constantly for your copied password!? … really?

So you may show them. :point_up_2:t4: :wink:

There are password managers without cloud extension. I am using KeePass with my team for several years without any problem.

OK, I cannot recommend something for your actual question. But since this is about security I personally would prefer a professional solution over a tinkered one. :wink:

… just my 2 ¢ :man_shrugging:t4:

Hmm Ill take another look at KeePass, its been awhile.

Just to be clear, Not looking to monitor the clipboard. When MS office apps close, it triggers the prompt to clear the clipboard if its full.

I want to trigger clearing the clipboard, as soon as any paste happens. I can easily do it manually, looking for an automated way to do it.

Thanks,

Matt

OK, but it is a different approach to check the clipboard when another app is closed than to check the clipboard when the clipboard is used. That’s what I meant earlier by a process where you actually trigger the pasting of the password already by PowerShell.

Hmm best I can recommend is just have a continuously running script that monitors and clears the clipboard after 5-10 seconds. That way you have time to paste it and you know it won’t stay there long.

I like that solution alot krzydoug, Ill give that a go.

Thanks!

Have a Happy New Year everyone!

If you copy your desired password 0.5 seconds before that cycle you have about 0.4 left to paste it to the desired target app … :point_up_2:t4: :smirk: :smirk: :smirk:

I don’t know where you copy it from and if the target app is always the same but why don’t you trigger the copying of the password, the activation of the target app and the pasting of the password all by a PowerShell script you can call by a keyboard shortcut? This way you don’t need a permanently running background job and you can trigger the clearing of the clipboard right after the pasting of the password. :man_shrugging:t4:

Edit:
Or you could use another scripting language actually specialized for tasks like this … AutohotKey or AutoIt.

Not exactly, it’s not just clearing every 5-10 seconds. It is checking for contents in clipboard every x seconds and once it finds contents it will clear them 5-10 seconds later. Not something I’m looking to do, just the only thing that came to mind for OPs question. Happy new year Olaf!

Ah, I see. That way it makes sense. :smiley: Nice actually. :+1:t4:

Happy New Year to you too! :fireworks: And Happy New Year Matthew! :slight_smile: