Skip to content

Instantly share code, notes, and snippets.

@mincaeuro
Last active December 7, 2018 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mincaeuro/42258ef73df0e14a7d5f4be5fda56c18 to your computer and use it in GitHub Desktop.
Save mincaeuro/42258ef73df0e14a7d5f4be5fda56c18 to your computer and use it in GitHub Desktop.
# filter expired cert with "UBS" in Issuer:
Get-ChildItem cert:\ -Recurse | Where-Object {$_ -like "*UBS*" -and $_.NotAfter -lt (Get-Date)} | Select-Object -Property Issuer
# or only by keyword "UBS":
Get-ChildItem cert:\ -Recurse | Where-Object {$_ -like "*UBS*"} | Select-Object -Property Issuer, NotAfter
# run 1st cmd to check the result, if its OK you can remove it:
Get-ChildItem cert:\ -Recurse | Where-Object {$_ -like "*UBS*" -and $_.NotAfter -lt (Get-Date)} | Remove-Item
# import via PS
Import-PfxCertificate -FilePath $env:USERPROFILE\Desktop\certfile.p12 -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String "<password>" -Force –AsPlainText)
#Above script wont be accepted by Java applets, to isntall it use this inc CMD line:
certutil -f -ImportPFX -user -p <password> shared_erste.p12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment