Samselvaprabu
Samselvaprabu

Reputation: 18227

What is the common practice to do Set-executionpolicy in production environment?

When providing script to customers, Script will not execute unless they did set-executionpolicy.

What is the common practice when providing a script to customers?

Whether set-executionpolicy would be run as first command in script so that it would execute without any error or some documents will be captured about set-executionpolicy.

I am giving powershell script first time to our customers. Previously i simply use to execute in our environment so i did not think about it.

Some one please help me to get some light on this

Upvotes: 5

Views: 2741

Answers (2)

Thomas Lee
Thomas Lee

Reputation: 1168

If I am providing a script to a customer, I'll digitially sign it and recommend that they consider using the REMOTESIGNED execution policy.

For most admins, though, I normally recommend UNRESTRICTED. These admins have sufficient power, making them jump through hoops to run code seems a waste of time. At the end of the day, they can ALWAYS run the code via one way or the other - so why waste time making signing a requirement.

Upvotes: 4

manojlds
manojlds

Reputation: 301477

One approach:

Also a send a bat file as a wrapper to the .ps1 which will do something like:

@powershell -ExecutionPolicy RemoteSigned -File script.ps1

Upvotes: 6

Related Questions