Use Windows PowerShell to Prepare Certificates

Procedure

To create a self-signed certificate using Windows PowerShell, refer to the following steps:

Note: The steps below are based on running the Windows PowerShell on a machine with the Windows 10 or Windows 11 operating system.

  1. Right-click Windows PowerShell on the machine and select Run as administrator from the drop-down list.
  2. Refer to the following example to use the New-SelfSignedCertificate cmdlet to generate certificate files.
    $cert = New-SelfSignedCertificate -Subject CN=AvePointCustomApp -CertStoreLocation 'Cert:\CurrentUser\My' -NotAfter (Get-Date).AddMonths(60)
    

    Press Enter on the keyboard.

  3. Export the .crt (or .cer) file by entering the following command:
    Export-Certificate -Cert $cert -FilePath IBMCustomApp.crt
    Note the following:
    • If you want to export a .cer file, replace the .crt with .cer in the cmdlet example above.
    • In this command, the file will be saved to the current working directory of the PowerShell session. If you want to specify a different directory, provide the full path by referring to the cmdlet example below:
      Export-Certificate -Cert $cert -FilePath "C:\Temp\IBMCustomApp.crt"
      
  4. Export the .pfx file with a password by entering the following command:
    Export-PfxCertificate -Password $(Read-Host -AsSecureString -Prompt "Enter a password to protect the certificate") -Cert $cert -FilePath IBMCustomApp.pfx
    Note the following:
    • The .pfx file contains your private key.
    • In this command, the file will be saved to the current working directory of the PowerShell session. If you want to specify a different directory, provide the full path by referring to the cmdlet example below:
      Export-PfxCertificate -Password $(Read-Host -AsSecureString -Prompt "Enter a password to protect the certificate") -Cert $cert -FilePath "C:\Temp\IBMCustomApp.pfx"

      Press Enter on the keyboard.

    If you want to remove the certificate files, enter the following command and press Enter on the keyboard:
    Remove-Item "Cert:\CurrentUser\My\$($cert.Thumbprint)”