BizTalk, Certificates and PowerShell.

Posted: October 11, 2010  |  Categories: Administration BizTalk PowerShell

About a month ago we had a problem migrating an old BizTalk application from the development environment to the quality environment. This application signs the incoming messages, based on the certificate installed on the machine and put this signature in one record in the body of the message, all of this is executed in the received pipeline. The certificated is loaded based on the thumbprint.

When we attempted to test the application we get the following error:

Cannot find a local machine certificate with the thumbprint: 5693ae76acfe33325bd6e1f05f38a9941892cb69 cannot be found.”

Because this was an old application and lack of documentation, our problem was in knowing what and where the certificate was installed.

Using MMC (Microsoft Management Console) we can see all the certificates installed on the machine, but we cannot search by thumbprint!!! 🙁

So I ask my friend José António Silva to show me the power of PowerShell to solve my annoying problem:

Solution 1

 gci cert:\* -Recurse | ?{$_.Thumbprint -eq "5693ae76acfe33325bd6e1f05f38a9941892cb69"} | select Subject, PSPath} 

The result will be something like this:

Subject                                     PSPath
——-                                        ——
O=”… S A “, C=PT, CN=… SA      Microsoft.PowerShell.Security\Certificate::CurrentUser\R…
O=”… S A “, C=PT, CN=… SA      Microsoft.PowerShell.Security\Certificate::LocalMachine\…
O=”… S A “, C=PT, CN=… SA     Microsoft.PowerShell.Security\Certificate::LocalMachine\…

Solution 2

 gci cert:\* -Recurse | ?{$_.Thumbprint -eq "5693ae76acfe33325bd6e1f05f38a9941892cb69"} | select PSParentPath 

Where this time the result will be a little more simple:

PSParentPath
————
Microsoft.PowerShell.Security\Certificate::CurrentUser\Root
Microsoft.PowerShell.Security\Certificate::LocalMachine\My
Microsoft.PowerShell.Security\Certificate::LocalMachine\Root

So now I know where is the certificated installed, and what was the certificate that I should install in a quality environment.

Download

THESE POWERSHELL SCRIPTS ARE PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download Check where a specific certificated is installed with PowerShell from GitHub here:

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top