Need Help creating a Power-shell Script

Mike
Mike used Ask the Experts™
Greeting Experts,

Can somebody help me create a PowerShell script to clear cached passwords in a Windows Operating System (7/10)....
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Have you seen this? It describes a simple batch file to perform the clear:

https://blogs.technet.microsoft.com/rmilne/2019/01/11/script-to-clear-credman/

Of course this can be converted to a PowerShell if required
MikeSecurity

Author

Commented:
do you have a sample script ...  like removing all creds from the cache.
Put this line in a batch like ClearKey.cmd and run it.

For /F "tokens=1,2 delims= " %%G in ('cmdkey /list ^| findstr Target') do  cmdkey /delete %%H

Open in new window


HTH
Get-CachedCredential| Where-Object{$_.User -match"admin-"} | %{Remove-CachedCredential $_.Target}

Open in new window



this will clear for admin, use similar
MikeSecurity

Author

Commented:
I was mainly looking to clear all cached creds... Michael Pfister it works perfectly ... thx..... aravind anche, thank you for the suggestion...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial