How to find certificates that are expiring on your server using PowerShell– Part 1

Home > Blogs > PowerShell > How to find certificates that are expiring on your server using PowerShell– Part 1

How to find certificates that are expiring on your server using PowerShell– Part 1

Like This Blog 2 Jason Helmick
Added by January 14, 2013

So, I’m often asked how to quickly find certificates that are about to expire so that they can be replaced. Here is a quick way to list the days remaining before the certificates on your server are about to expire.

PS> Get-ChildItem -Path Cert:\LocalMachine\My | Select-Object -Property PSComputerName, Subject, @{n=’ExpireInDays’;e={($_.notafter – (Get-Date)).Days}}

By adding a Where-Object filter, you can filter the list so that only certificates that are going to expire in 90 days are displayed.

PS> Get-ChildItem -Path Cert:\LocalMachine\My | Select-Object -Property PSComputerName, Subject, @{n=’ExpireInDays’;e={($_.notafter – (Get-Date)).Days}} | Where-Object {$_.ExpireInDays -lt 90}

If you have multiple servers such as a web farm, you can use PowerShell Remoting to check all your servers at once! Check out the same one-liners using PowerShell remoting Locating IIS certificates before the expire.

Pretty cool huh?

For more, read Part 2: How to find certificates that are expiring on your server using PowerShell

Knowledge is PowerShell

Jason Helmick
Director of PowerShell Technologies
Interface Technical Training

Videos You May Like

A Simple Introduction to Cisco CML2

0 3876 0

Mark Jacob, Cisco Instructor, presents an introduction to Cisco Modeling Labs 2.0 or CML2.0, an upgrade to Cisco’s VIRL Personal Edition. Mark demonstrates Terminal Emulator access to console, as well as console access from within the CML2.0 product. Hello, I’m Mark Jacob, a Cisco Instructor and Network Instructor at Interface Technical Training. I’ve been using … Continue reading A Simple Introduction to Cisco CML2

Cable Testers and How to Use them in Network Environments

0 720 1

This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader demonstrates how to use cable testers in network environments. Let’s look at some tools that we can use to test our different cables in our environment. Cable Testers Properly Wired Connectivity … Continue reading Cable Testers and How to Use them in Network Environments

Government Edition – Encrypting a USB Flash Drive in Windows 10

0 274 2

In this video, Security Instructor Mike Danseglio demonstrates how to use BitLocker in Window 10 to secure files on a USB Flash drive that adhere to stricter data protection requirements as found inside Government entities. BitLocker 2-day instructor-led training is now available at Interface: BITLOCK: Planning and Deploying BitLocker Drive Encryption Training Video Transcription: Hi. … Continue reading Government Edition – Encrypting a USB Flash Drive in Windows 10

Write a Comment

See what people are saying...

    Share your thoughts...

    Please fill out the comment form below to post a reply.