Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Computer Certificate tools

Posted on December 21, 2015

In my Pluralsight course on Advanced DSC I used a few functions I wrote to make it easier to work with computer certificates. If you need to encrypt things like passwords in a DSC configuration,  you must some type of certificate thumbprint as well as a copy of the certificate. The idea is that you can use the exported certificates public key to encrypt the password. The remote computer then uses the private key to decrypt.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

The functions I wrote for the course were relatively simple, but I always knew I would re-visit them. Now I have. Not only have I extended the functionality, I've also turned the functions into a module.

The module contains two functions, Export-MachineCertificate and Get-MachineCertificateThumbprint.  They are very similar in terms of their output, except that the export function does just that, it exports the certificate. I have a hard coded path of C:\Certs but you can change that.

The commands rely on the PKI module that you should have on Windows 8 and later.

Exporting a certificate

By default, the function will also test if the certificate is valid, although you can skip that test.

If you just want the thumbprint, you can use the other command.

Getting a certificate thumbprint

I suppose I could have combine the functions into one.  In fact, as I write this I can think of a few other changes I might have made but I think I will leave things as they stand.

You can find the files on GitHub.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d