But doing that, setting policy to "RemoteSigned", wouldn't compromise the
security? My basic question is how I would I run Exchange PS scripts in
background, like from win32 service or as scheduled job. Here are the options
I see but each has its drawbacks.
- Set the execution policy to "RemoteSigned" before running the scripts and
reset back to "restricted".
- If I set the policy to "AllSigned", I can't run as win32 service because
there will be a prompt.
I was wondering is there a better way to run the PS scripts as win32 service
without changing the default policy of powershell. Is creating new runspace
or shell would help? I'm new to Powershell and looking for some ideas.
RD
"Marco Shaw [MVP]" wrote:
> RD wrote:
> > The documents say that the default execution policy of Powershell is
> > "Restricted". But it appears to me that whey you install Exchange server
> > 2007, the policy is changed to "RemoteSigned". Is that correct? If so, how
> > can I run Exchange PS1 scripts with default security policy of PS. Thanks. >
> The default execution policy is 'restricted'. With that policy, you
> won't be able to run scripts at all.
>
> You need to determine what your security policy for writing and running
> scripts will get.
>
> Check out:
> get-executionpolicy
> and
> set-executionpolicy
>
> To set the default PS policy:
> PSH> set-executionpolicy restricted
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>