'powershell signing certificate unknownerror

I am following the instructions to sign a script

and I've got to the part where I sign the add-signature.ps1 file so that I can sign my script using it

$cert = @(Get-ChildItem cert:\CurrentUser\My -codesigning)[0]
Set-AuthenticodeSignature add-signature.ps1 $cert

and I get this error: enter image description here

I've Googled endlessly but found no solutions! I'm running PS in Administrator mode and I've set the policy for CurrentUser to AllSigned

enter image description here

Can anyone help me? Do I need to set all the policies to AllSigned?

UPDATE: Deleting all the Certs and starting again, following the Microsoft instructions: enter image description here and of course I get an error when I try to run the add-signature.ps1 script - help!



Solution 1:[1]

Importing the cert to \CurrentUser\Root as well as TrustedPublisher worked

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ryan M