Skip to content

Commit 52d05fa

Browse files
committed
Up the execution policy for default PWSH sessions
This is required to run the diagnostics script, and any script that either we create here, or the user creates later. At least we don't go too wild and use unrestricted... we use something more "safe"
1 parent 463845f commit 52d05fa

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

functions/microwin/Invoke-Microwin.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ public class PowerManagement {
208208
reg add "HKLM\zSOFTWARE\WinUtil" /f
209209
reg add "HKLM\zSOFTWARE\WinUtil" /f /v "ToolboxVersion" /t REG_SZ /d "$($sync.version)"
210210
reg add "HKLM\zSOFTWARE\WinUtil" /f /v "MicroWinBuildDate" /t REG_SZ /d "$((Get-Date).ToString('yyMMdd-HHmm'))"
211+
212+
# REAL software developers set execution policies to unrestricted but, because we're targeting
213+
# mainstream population, we have to lower the level of "riskiness" -- set remotesigned; at least that
214+
# lets us run PWSH scripts that WE create. Execution policies don't really make sense anyway if common sense
215+
# is lacking.
216+
reg add "HKLM\zSOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" /v "ExecutionPolicy" /t REG_SZ /d "RemoteSigned" /f
217+
211218
reg unload HKLM\zSOFTWARE
212219

213220
if ($importVirtIO) {

0 commit comments

Comments
 (0)