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