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"
This commit is contained in:
CodingWonders
2025-12-21 11:03:56 +01:00
parent 463845fd13
commit 52d05fab6c

View File

@@ -208,6 +208,13 @@ public class PowerManagement {
reg add "HKLM\zSOFTWARE\WinUtil" /f
reg add "HKLM\zSOFTWARE\WinUtil" /f /v "ToolboxVersion" /t REG_SZ /d "$($sync.version)"
reg add "HKLM\zSOFTWARE\WinUtil" /f /v "MicroWinBuildDate" /t REG_SZ /d "$((Get-Date).ToString('yyMMdd-HHmm'))"
# REAL software developers set execution policies to unrestricted but, because we're targeting
# mainstream population, we have to lower the level of "riskiness" -- set remotesigned; at least that
# lets us run PWSH scripts that WE create. Execution policies don't really make sense anyway if common sense
# is lacking.
reg add "HKLM\zSOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" /v "ExecutionPolicy" /t REG_SZ /d "RemoteSigned" /f
reg unload HKLM\zSOFTWARE
if ($importVirtIO) {