Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

ExecutionPolicy Restricted MachinePolicy

Hi,

we have Powershell ExecutionPolicy GPO / Restricted MachinePolicy in place, but I can override it with registry cmd and then deploy. 

reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell" /v ExecutionPolicy /t REG_SZ /F /d "ByPass"

reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell" /v EnableScripts /t REG_DWORD /F /d 1

Question:

is there option to add (or trigger) this registry command in front of every deploy? (i have too many packages to go over and add as Pre-Step) a'la preferences level settings like you have Ping before deployment, send WoL before etc. or to help think best option for this (maybe Pre-Step but easier way, like command prompt add to all) ?

Thanks!

0

Comments

1 comment
Date Votes
  • Hi maki,
    I am using a batch script:

    reg add HKLM\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /v "ExecutionPolicy" /d "Unresticted" /t "REG_SZ" /f
    powershell -executionPolicy bypass -noexit -file "powershell-script.ps1"
    reg add HKLM\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /v "ExecutionPolicy" /d "Resticted" /t "REG_SZ" /f

    0