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!
Comments
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