Powershell script to remove cached credentials
had issue other day able change password on aduc logged in domain user account. turns out domain admin credentials has cached on computer inadvertently. have script run on pc on startup or login looks cached credentials start prefix , if there - remove them. found following module pretty close need doesn't filter specific username that. target or type. willing me modify specific user or user starts "x"?
https://gallery.technet.microsoft.com/scriptcenter/cached-credentials-99b1dfdc/view/discussions
this looks can them all, , lists them, function remove specific target, cant remove target contains x user.
here example of produces.
target type user
------ ---- ----domain:target=termsrv/server01 domain password mydomain\admin-john
domain:target=test domain password admin-john
so if can use search user contains "admin-" should able use remove cached domain admin credentials on computers , clean security vulnerability.
thanks
john
get-cachedcredential| where-object{$_.user -match"admin-"} | %{remove-cachedcredential $_.target}
\_(ツ)_
Windows Server > Windows PowerShell
Comments
Post a Comment