Token Based Software Activation with PowerShell
Last updated on April 14, 2021.
Last Reviewed and Approved on PENDING REVIEW
Intended Audience
This document is intended for use by the Lead Service Integrator (LSI) or developer.
Introduction
During a new vehicle field activation, you will likely need to activate a Windows Operating System and/or Microsoft Office products. There are three primary methods that can be used: PowerShell, RPS runbooks, and through the RPS Web User Interface.
Assumptions
The following is assumed prior to performing the actions described in this article:
- You have access to the certificate (token), the public certificate, and issuance license file mentioned in the requirements above.
- You have access to PowerShell and the
Rps-SoftwareActivation
module is installed.
Token Based Activation Requirements and Pre-Requisites
Token Based Activation Pre-Requisites
To activate Microsoft products via token based activation, three things are needed:
The certificate (token) that will be used to activate the software.
The public certificate from the Certificate Authority that signed the activation token.
The issuance license file that defines what software products will be activated.
Installing Pre-Requisites
Before activating any software, you must establish your working session. To do so, execute the following PowerShell Command in PowerShell ISE Administrator Mode.
Important
Start by establishing your working session in PowerShell ISE Administrator Mode.
Click on the Search Icon from the Start Menu.
Figure 1: Click on Search Icon.
Search for PowerShell ISE by typing PowerShell ISE in the Search bar.
Figure 2: Search for PowerShell ISE.
Click on Run As Administrator.
Figure 3: Open PowerShell ISE as Administrator.
Note
Any component of the PowerShell scripts below that are bookended by single quotes, must be replaced with use specific data (i.e., setting your own password).
Install the Required Certificates. The following cmdlet will install both the certificate (token) and public certificate:
$certificatePassword = ConvertTo-SecureString -String 'password!' -AsPlainText -Force Install-TokenBasedActivationCertificate -ActivationPrivateCertificate 'tokenBasedActivation.pfx' -Password $certificatePassword -ActivationPublicCertificate 'MicrosoftProductActivationPCA 2017.cer'
Install the Issuance License File. The following cmdlet will install the issuance license:
Install-SoftwareActivationIssuanceLicense -IssuanceLicensePath 'C:\Windows Client_Server_Office_Visio_SHA2.Request52416.xrm-ms' -Verbose
After completing the pre-requisites, you can now activate the Windows OS and/or Office Product.
Activating a Windows OS
To activate a Windows OS, execute the PowerShell commands below. This PowerShell cmdlet searches through the local machine certificate store to find the certificate that has "Microsoft Product Activation" in the Subject. This will be the certificate used as the token for activation.
$cert = dir Cert:\LocalMachine\My | Where {$_.Subject -match 'Microsoft Product Activation'}
Register-TokenActivationIssuanceLicense -CertificateThumbprint $cert.Thumbprint -Verbose
Activating a Microsoft Office Product
To activate an Office product, execute the PowerShell commands below. This PowerShell cmdlet is used to activate Office and requires both the thumbprint of the certificate used for activation and the path to the issuance license file.
$cert = dir Cert:\LocalMachine\My | Where {$_.Subject -match 'Microsoft Product Activation'}
Register-OfficeProductActivation -IssuanceLicensePath 'license.xml' -CertificateThumbprint $cert.Thumbprint