Set FriendlyName using PowerShell (post-request PS script)

Has anyone tried settiing FriendlyName on the cert via a post-script? I’ve tried the following but I get an error (attached);

$hashPath = “Cert:\LocalMachine\My$result.ManagedItem.CertificateThumbprintHash”

(Get-ChildItem -Path $hashPath).FriendlyName = ‘*’

Thanks ahead for any advice!


Hi Corey,

Here is a scripting example to set the friendly name:


if ($result.IsSuccess) {

   $thumbprint = $result.ManagedItem.CertificateThumbprintHash # e.g. 2c127d49b4f63d947dd7b91750c9e57751eced0c

   # remove the old cert (by Friendly Name 'vdm') to avoid duplication, if it exists
   Get-ChildItem -Path cert:\LocalMachine\My | Where {$_.FriendlyName.Equals("vdm")} | Remove-Item

   # rename our new certificate
   $cert = Get-ChildItem -Path cert:\LocalMachine\My$thumbprint

   $cert.FriendlyName ="vdm"

   # restart the wstunnel service to apply certificate
   Restart-Service wstunnel -Force -ErrorAction Stop

Thank you for the intel. I appreciate it!

1 Like