Sometimes if you write the PowerShell script locally and try to run it using the PowerShell command prompt, then most of the time you will get an error: the script is not digitally signed. You cannot run this script on the current system. As shown in the following image.
Why are you getting exception?
Script execution is blocked by default due to the insufficient script execution permission on your machine.
How to resolved the issue?
You have to set the execution policy to unrestricted by using the following PowerShell command.