1. Make sure your HSM (.e.g, USB Token) containing the Code Signing certificate is plugged into your computer or laptop.
2. Open Windows PowerShell.
3. To view all your Code Signing Certificates type the command below:
Get-ChildItem Cert:\CurrentUser\My –codesign
Note: You will see all your code signing certificates in an order that start from 0, 1, 2…
4. Next, sign your script with the preferred Code Signing Certificate. If you have multiple Code Signing Certificates in the USB Hard Token based on the order of 0, 1, 2… as mentioned in Step 3, you may need to enter the password to access the token after running below cmdlet.
For this example, I have created a PowerShell script name “testscript.ps1” and I will used the Code Signing Certificate which is located on location  –
“BB9373B96D226CAB1134E89535B590B681B8A37F CN="Entrust, Inc.", O="Entrust, Inc.", L=Kanata, S=Ontario, C=CA”
Cmdlet to use: