I'm getting an error when I run a PowerShell script:
File test_new.ps1 cannot be loaded. The file test_new.ps1 is not digitally signed.
I created a CA and a certificate and signed this file using the procedure described here.
Here is when I do a dir on the MY directory:
EF76B3D7D8D2406E1F2EE60CC40644B122267F18 CN=PowerShell User
I can see the signature block appended at the end of the test_new.ps1 file.
Here is the execution policy and scope:
Scope ExecutionPolicy
----- ---------------
MachinePolicy AllSigned
UserPolicy Undefined
Process Bypass
CurrentUser AllSigned
LocalMachine Undefined
The machinepolicy should take priority which is set as AllSigned. Everything seems allright, why am I still getting the digitally signed error.

dirwith the parameter-Codesigning? Is the CA certificate imported correctly?-Codesigningit wasn't working. But I have finally figured it out. I had to publish the certificate inTrusted Root Certification Authorities. After which it started working. See my answer below