Fix errors in the PowerManagement module

This commit is contained in:
Manuel Thalmann 2024-08-01 02:19:05 +02:00
parent fab3c239f6
commit ee077e0765

View file

@ -4,6 +4,7 @@ using namespace Microsoft.Win32;
$null = New-Module {
[RegistryKey] $key = $null;
$runOncePath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce";
$runOnceName = "PortValhalla";
<#
.SYNOPSIS
@ -27,12 +28,13 @@ $null = New-Module {
$key = Get-RunOnceKey $UserKey;
Set-ItemProperty -Path $key.PSPath -Name $runOnceName -Type "ExpandString" -Value `
"pwsh -Command " + `
"`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);" + `
"`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection $env:INSTALLER_SCRIPT);" + `
"`$env:CONFIG_MODULE = $(ConvertTo-Injection $env:CONFIG_MODULE);" + `
"& `$env:INSTALLER_SCRIPT;";
Set-ItemProperty -Path $key.PSPath -Name $runOnceName -Type "ExpandString" -Value (
"pwsh -Command " +
"`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);" +
"`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection $env:INSTALLER_SCRIPT);" +
"`$env:CONFIG_MODULE = $(ConvertTo-Injection $env:CONFIG_MODULE);" +
"& `$env:INSTALLER_SCRIPT;"
);
$key.Handle.Close();
}