You can find expiring user certificates in Windows 10 and Windows 11 by querying the Cert:\CurrentUser\My path in Windows PowerShell using Get-ChildItem with either the dynamic -ExpiringInDays parameter or a Where-Object date filter against each certificate's NotAfter property, piping the results to Sort-Object NotAfter to order them chronologically, and passing the output to Export-Csv to generate a reviewable audit spreadsheet. Because the PowerShell Certificate provider (Microsoft.PowerShell.Security) is built into Windows PowerShell 5.1 on every supported edition of Windows 10 and Windows 11—and is also available in PowerShell 7.1 and later—you can inspect, sort, and export personal user certificates without installing extra modules or requiring local administrator privileges.

A Windows desktop shows PowerShell and a spreadsheet tracking certificate expirations, with a summary panel and calendar. Prerequisites and Scope​

Before inspecting certificate stores, ensure your environment meets these conditions:

  • Supported operating systems: Windows 10 (all editions) and Windows 11 (all editions). The commands also work identically on Windows Server 2016, 2019, 2022, and 2025.
  • PowerShell version: Built-in Windows PowerShell 5.1 (powershell.exe) or PowerShell 7.1 and later (pwsh.exe). Note that according to Microsoft's Certificate provider documentation, the -ExpiringInDays dynamic parameter is included in Windows PowerShell 5.1, was omitted in PowerShell 6.0 through 7.0, and was reintroduced in PowerShell 7.1.
  • Account permissions: Standard user permissions are sufficient to read Cert:\CurrentUser. However, because Cert:\CurrentUser always maps to the security context of the account running the PowerShell process, you must run PowerShell under your normal signed-in user account. Do not select Run as administrator if your administrator account is a separate user profile, or PowerShell will query the administrator's personal certificate store instead of yours.
  • Export destination: A writable folder path for the CSV export, such as $HOME\Documents or $HOME\Desktop.

Understanding User Certificate Store Paths and Properties​

The Windows PowerShell Certificate provider exposes certificate store locations as a virtual drive named Cert:. It divides certificates into two top-level locations: CurrentUser (certificates tied to your individual Windows user profile, such as S/MIME email certificates, client authentication certificates for VPN or Wi-Fi, and user code-signing certificates) and LocalMachine (computer-wide certificates used by services, IIS, and device authentication).

When you open the graphical user certificate manager (certmgr.msc), the folder labeled Personal -> Certificates corresponds directly to the PowerShell path Cert:\CurrentUser\My. Each certificate stored in Cert:\CurrentUser\My is returned as a System.Security.Cryptography.X509Certificates.X509Certificate2 object augmented with PowerShell script properties. The most useful properties for expiration auditing are:

  • Subject: The distinguished name of the user, device, or entity the certificate was issued to.
  • FriendlyName: An optional display alias assigned to the certificate.
  • Issuer: The Certificate Authority (CA) that signed and issued the certificate.
  • NotAfter: A System.DateTime object representing the exact local date and time when the certificate expires.
  • NotBefore: A System.DateTime object representing when the certificate's validity period began.
  • Thumbprint: The unique hexadecimal hash identifier for the certificate.
  • HasPrivateKey: A Boolean ($true or $false) indicating whether your user profile holds the corresponding private key.
  • DnsNameList and EnhancedKeyUsageList: Provider-added collection properties showing the Subject Alternative Names (or Subject fallback) and the permitted usages (such as Client Authentication or Secure Email).

Primary Procedure: Find, Sort, and Export Expiring User Certificates​

Follow these steps in execution order to inspect your personal user store, filter for expiring certificates, sort the list by expiration date, and save the report to a CSV file.

Step 1: Open Windows PowerShell as the Target User​

  1. On Windows 11, right-click the Start button and select Terminal (or press Win + R, type powershell, and press Enter). Ensure the active tab profile is running Windows PowerShell or PowerShell under your standard user account.
  2. On Windows 10, right-click the Start button and select Windows PowerShell (not Windows PowerShell (Admin) unless your daily account is the same account), or press Win + R, type powershell, and press Enter.
  3. Confirm your current user identity by running:
    whoami
    Verify that the returned DOMAIN\username or COMPUTER\username matches the account whose certificates you want to inspect.

Step 2: List All Certificates in Your Personal User Store​

Before filtering by date, list all certificates in your personal store sorted by expiration date so you have a baseline view of how many certificates exist:

Code:
Get-ChildItem -Path Cert:\CurrentUser\My |
    Sort-Object -Property NotAfter |
    Select-Object -Property Thumbprint, Subject, NotAfter, Issuer, HasPrivateKey |
    Format-Table -AutoSize

If your personal store contains certificates, PowerShell displays a table ordered from the earliest NotAfter date (oldest or already expired) at the top to the furthest expiration date at the bottom.

Step 3: Find User Certificates Expiring Within a Specific Number of Days​

You can identify certificates nearing expiration using either the Certificate provider's built-in -ExpiringInDays dynamic parameter or an explicit Where-Object date filter. Both methods are important because -ExpiringInDays includes certificates that have already expired in the past, whereas a two-sided Where-Object filter lets you isolate only certificates that are currently valid but expiring soon.

Option A: Using the -ExpiringInDays Dynamic Parameter (Includes Already-Expired Certificates)​

To find all certificates in your personal store that will expire within the next 60 days (or have already expired), sorted with the most urgent dates first, run:

Code:
Get-ChildItem -Path Cert:\CurrentUser\My -ExpiringInDays 60 |
    Sort-Object -Property NotAfter |
    Select-Object -Property NotAfter, Thumbprint, Subject, Issuer, HasPrivateKey
  • Change 60 to 30, 90, or any integer matching your renewal window.
  • Passing -ExpiringInDays 0 returns only certificates that have already expired as of the exact moment the command runs.

Option B: Using Where-Object to Isolate Only Upcoming Expirations (Excludes Already-Expired Certificates)​

In many Windows profiles, legacy or superseded certificates remain in Cert:\CurrentUser\My long after they expire. To list only active certificates that are currently valid (NotAfter is greater than right now) and will expire within the next 60 days, run:

Code:
$Now = Get-Date
$CutoffDate = $Now.AddDays(60)

Get-ChildItem -Path Cert:\CurrentUser\My |
    Where-Object { $_.NotAfter -gt $Now -and $_.NotAfter -le $CutoffDate } |
    Sort-Object -Property NotAfter |
    Select-Object -Property NotAfter,
        @{Name = 'DaysRemaining'; Expression = { ($_.NotAfter - $Now).Days }},
        Thumbprint,
        Subject,
        FriendlyName,
        Issuer,
        HasPrivateKey

This command calculates a DaysRemaining column on the fly and sorts the output in ascending order of NotAfter, placing the certificate closest to expiring at the top of the output.

Step 4: Export the Sorted Results to a CSV File for Review​

When exporting certificate objects to CSV, always pipe Select-Object directly into Export-Csv. Never place Format-Table or Format-List before Export-Csv, or the CSV file will contain internal PowerShell formatting metadata (Microsoft.PowerShell.Commands.Internal.Format...) instead of certificate properties.

In addition, if you want to include the certificate's Enhanced Key Usages (such as Client Authentication or Code Signing) or Subject Alternative Names in a CSV, you must flatten those collection properties into a text string; otherwise, Export-Csv outputs the type name (System.Collections.ObjectModel.Collection...) in the spreadsheet column.

Run the following script block to find all personal user certificates expiring within 90 days (including calculated days remaining and flattened key usage names), sort them by expiration date, and export them to your Documents folder:

Code:
$DaysToCheck = 90
$Now = Get-Date
$ExportPath = Join-Path -Path ([Environment]::GetFolderPath('MyDocuments')) -ChildPath "ExpiringUserCerts_$(Get-Date -Format 'yyyyMMdd').csv"

Get-ChildItem -Path Cert:\CurrentUser\My -ExpiringInDays $DaysToCheck |
    Sort-Object -Property NotAfter |
    Select-Object -Property @(
        'NotAfter',
        @{Name = 'Status'; Expression = {
            if ($_.NotAfter -le $Now) { 'Expired' } else { 'Expiring Soon' }
        }},
        @{Name = 'DaysRemaining'; Expression = { ($_.NotAfter - $Now).Days }},
        'Subject',
        'FriendlyName',
        'Issuer',
        'Thumbprint',
        'SerialNumber',
        'NotBefore',
        'HasPrivateKey',
        @{Name = 'EnhancedKeyUsage'; Expression = {
            ($_.EnhancedKeyUsageList.FriendlyName) -join '; '
        }},
        @{Name = 'DnsNames'; Expression = {
            ($_.DnsNameList.Unicode) -join '; '
        }}
    ) |
    Export-Csv -Path $ExportPath -NoTypeInformation -Encoding UTF8
  • Windows PowerShell 5.1 note: Including -NoTypeInformation suppresses the #TYPE Selected.System.Security.Cryptography.X509Certificates.X509Certificate2 header line that Windows PowerShell 5.1 otherwise writes to line 1 of the CSV file. (PowerShell 7 omits type headers by default, though -NoTypeInformation remains accepted for backward compatibility.)

Verification of Success​

After running Step 4, verify that the CSV file was created and contains properly structured certificate rows before opening it in Microsoft Excel or another spreadsheet viewer:

  1. Check that the file exists and is non-empty:
    Get-Item -Path $ExportPath | Select-Object FullName, Length, LastWriteTime
  2. Re-import the CSV in PowerShell to verify that the columns and sort order are intact:
    Import-Csv -Path $ExportPath | Format-Table -Property NotAfter, Status, DaysRemaining, Subject, Thumbprint -AutoSize
  3. If you want to visually cross-check a specific certificate from the CSV inside the Windows certificate dialog, copy its Thumbprint value and pass it to Invoke-Item:
    Invoke-Item -Path "Cert:\CurrentUser\My\<Thumbprint>"
    Replacing <Thumbprint> with the actual string opens the native Windows Certificate viewer dialog for that exact certificate.

Alternate Method: Scan All CurrentUser Stores or Filter by Purpose​

Sometimes a user certificate is placed in another sub-store under Cert:\CurrentUser (such as TrustedPeople, WebHosting, or Intermediate Certification Authorities) or you need to narrow a crowded store down to a specific certificate purpose.

Scanning All CurrentUser Certificate Stores Recursively​

WARNING: Windows ships with and retains historic root and intermediate certificates in Cert:\CurrentUser\Root, Cert:\CurrentUser\AuthRoot, and Cert:\CurrentUser\CA that have passed their NotAfter dates. Windows keeps these expired certificates intentionally to validate counter-signatures and timestamps on older signed binaries and documents. Do not delete expired certificates from Root, AuthRoot, or CA stores unless directed by your organization's PKI administrator.

When you use -Recurse starting at Cert:\CurrentUser, Get-ChildItem returns both store container objects (X509Store) and certificate objects (X509Certificate2). If you use a Where-Object filter on NotAfter without -ExpiringInDays, filter out store containers using !$_.PSIsContainer and capture the parent store name from PSParentPath:

Code:
$Now = Get-Date
$CutoffDate = $Now.AddDays(60)

Get-ChildItem -Path Cert:\CurrentUser -Recurse |
    Where-Object { -not $_.PSIsContainer -and $_.NotAfter -gt $Now -and $_.NotAfter -le $CutoffDate } |
    Sort-Object -Property NotAfter |
    Select-Object -Property @(
        @{Name = 'Store'; Expression = { $_.PSParentPath -replace '^.*\\', '' }},
        'NotAfter',
        @{Name = 'DaysRemaining'; Expression = { ($_.NotAfter - $Now).Days }},
        'Subject',
        'Issuer',
        'Thumbprint'
    ) |
    Format-Table -AutoSize

Filtering Expiring User Certificates by Code Signing or EKU​

When querying the Cert: drive, Get-ChildItem unlocks additional dynamic parameters that can be combined with -ExpiringInDays:

  • Code-signing certificates only:
    Code:
    Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert -ExpiringInDays 90 |
        Sort-Object -Property NotAfter
  • Client Authentication or Secure Email certificates (using -EKU):
    Code:
    Get-ChildItem -Path Cert:\CurrentUser\My -EKU "*Client Authentication*" -ExpiringInDays 90 |
        Sort-Object -Property NotAfter

Troubleshooting and Rollback​

Common Failure Modes and Fixes​

  • Get-ChildItem : A parameter cannot be found that matches parameter name 'ExpiringInDays':
    • Cause: You are either running the command without specifying a Cert: path (dynamic parameters only bind when -Path targets the Cert: drive or your current prompt location is inside Cert:), or you are running an older PowerShell 6.x or 7.0 build where -ExpiringInDays was not present.
    • Fix: Ensure -Path Cert:\CurrentUser\My is explicitly included in the Get-ChildItem command, or switch to Windows PowerShell 5.1 (powershell.exe) / upgrade to PowerShell 7.1+ (pwsh.exe), or use the Where-Object { $_.NotAfter -le (Get-Date).AddDays(60) } method shown in Step 3 Option B.
  • The query returns zero certificates, or Export-Csv generates a completely blank (0-byte) file:
    • Cause: Either no certificates in Cert:\CurrentUser\My expire within the specified window, or you launched PowerShell elevated as a different administrator user account whose Cert:\CurrentUser\My store is empty.
    • Fix: First run Get-ChildItem -Path Cert:\CurrentUser\My without any date filters to see if any certificates exist in your user store. If certificates appear in certlm.msc (Local Computer) rather than certmgr.msc (Current User), query Cert:\LocalMachine\My instead.
  • Spreadsheet columns show System.Security.Cryptography.OidCollection or Microsoft.PowerShell.Commands...:
    • Cause: Either Format-Table was placed before Export-Csv in the pipeline, or multi-value array properties (EnhancedKeyUsageList, DnsNameList, Extensions) were passed to Select-Object without joining them into a string.
    • Fix: Remove Format-Table prior to Export-Csv, and join multi-value properties with -join '; ' inside a calculated property hash table as shown in Step 4.
  • Sort-Object NotAfter sorts alphabetically instead of chronologically:
    • Cause: NotAfter was converted to a formatted string (for example, with .ToString('MM/dd/yyyy') inside Select-Object) before Sort-Object ran in the pipeline.
    • Fix: Always place Sort-Object -Property NotAfter before Select-Object so PowerShell sorts the underlying System.DateTime values rather than text strings.

Safety and Rollback if Cleaning Up Expired User Certificates​

Inspecting, sorting, and exporting certificates with Get-ChildItem, Sort-Object, Select-Object, and Export-Csv is strictly read-only and makes no changes to your system state.

WARNING: If you decide to remove expired user certificates from Cert:\CurrentUser\My after reviewing your CSV report, do not delete expired S/MIME email encryption certificates! If you delete an expired S/MIME certificate and its private key, you will permanently lose the ability to decrypt older encrypted emails and files that were encrypted with that public key.

If you plan to remove an obsolete certificate from Cert:\CurrentUser\My, export a backup copy first so you can roll the change back if an application or historical file still depends on it:

  1. Back up the certificate before removal:
    • To back up only the public certificate (.cer), run:
      Export-Certificate -Cert "Cert:\CurrentUser\My\<Thumbprint>" -FilePath "$HOME\Documents\BackupCert_<Thumbprint>.cer"
    • If HasPrivateKey is $true and the private key is marked exportable, back up both the certificate and private key to a password-protected .pfx file using Export-PfxCertificate or by right-clicking the certificate in certmgr.msc and selecting All Tasks -> Export.
  2. Restore (roll back) a removed user certificate:
    • For a .cer backup:
      Import-Certificate -FilePath "$HOME\Documents\BackupCert_<Thumbprint>.cer" -CertStoreLocation Cert:\CurrentUser\My
    • For a .pfx backup:
      Code:
      $PfxPassword = Read-Host -Prompt "Enter PFX password" -AsSecureString
      Import-PfxCertificate -FilePath "$HOME\Documents\BackupCert_<Thumbprint>.pfx" -CertStoreLocation Cert:\CurrentUser\My -Password $PfxPassword