List Certificates for Local Machine and Current User

Sometimes when we’re debugging certificates on a Microsoft Windows operating system, we want to be able to quickly see what store a certificate belongs to. This PowerShell script will list certificates for the local machine and current user certificate stores.

get-childitem -Path Cert:\ | foreach-object ({
    $location = $_.Location
    foreach($store in $_.StoreNames.Keys) {         
        get-childitem -Path "Cert:\$location\$store" | foreach-object ({
            $thumb = $($_.ThumbPrint)
            $issuer = $($_.Issuer)          
            write-host "$location $store $issuer"
        })
    }
})