Execution Policy error

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
VivekK
Posts: 1
Joined: Tue Sep 08, 2020 8:19 pm

Execution Policy error

Post by VivekK »

I was just trying to Power Studio and was writing simple get-addomaincontroller BUT when I ran it, it gave me error for execution policies.

I set execution policy as unristricted in form load and on button as well, but failed.

Anyone has any idea on this ?

NOTE: I dont want to set execution policy on system first and then run the program, that will beat the purpose, I would like the execution policies to either remain same or reverted back once the program deployed, written by this app, is used.

jvierra
Posts: 14579
Joined: Tue May 22, 2007 9:57 am
Answers: 1
Been upvoted: 1 time
Contact:

Re: Execution Policy error

Post by jvierra »

You cannot override domain execution policy. You cannot change execution policy in a script.

Run "Get-ExecutionPolicy -List" at a PS prompt to discover the settings.

User avatar
Alexander Riedel
Posts: 7501
Joined: Tue May 29, 2007 4:43 pm

Re: Execution Policy error

Post by Alexander Riedel »

Try packaging the script as an executable.
You don't say which PowerShell version you are using, so ....
Alexander Riedel
SAPIEN Technologies, Inc.

Locked