Install the WSUS code-signing certificate with Powershell

Install the WSUS code-signing certificate with Powershell

Summary

This article provides useful steps to install the code-signing certificate required by the Software Vulnerability Manager at WSUS to enable publishing integration between SVM and all WSUS APIs. We also listed more useful tips around certificate handling with Powershell as it is very handy to leverage PowerShell for WSUS-related certificate operations. 

Synopsis

1. Open up Powershell as Administrator on your WSUS server, or Software Update Point of SCCM. 

2. Run the following to set the WSUS server and its configuration to an object.

[Reflection.Assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$updateServer = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer()
$config = $updateServer.GetConfiguration()


3. Next, run this snippet to set the new code signing certificate. 

$config.SetSigningCertificate("<Path to pfxFile>", "<PFX file password>")

Bear in mind, this will be a file with both the public and private keys (pfx usually).
You'll need to replace the path and private key password within the placeholder values in quotes.

4. Now save the changes. 

$config.Save()

Cert:\

The Powershell PSProvider "Certificate" gives the shell direct access to certificate stores of the system or the user depending on where you want to go. To get a quick glimpse of that, use this command:

Get-PSProvider

powershell Get-PsProvider.PNG

You can go about the Cert PSProvider as you do basic filesystem browsing using dir (Get-ChildItem😞

poweshell basic dir certs.png

In PowerShell ISE you can get the path prediction to display your options next effortlessly. 
That makes it very easy to predict all of the member properties of the certificates you can use as a filter. 

For example, let's say you're interested to get all certificates and filter them through a where clause that outputs only those that have a private key at your WSUS stores. You can make use the HasPrivateKey property, as per the below example, to get all certificates that have a private key in them:

PS ISE has private key.png

The example output of this sample query looks similar to the following in one of my test labs:

powershell query wsus private key.PNG

 

Was this article helpful? Yes No
No ratings
Version history
Revision #:
4 of 4
Last update:
‎Sep 26, 2019 05:25 AM
Updated by:
 
Contributors