Convert Argument to string explicitly

This commit is contained in:
Manuel Thalmann 2024-08-16 23:03:19 +02:00
parent 55043420aa
commit 8d7835a8aa

View file

@ -51,7 +51,7 @@ $null = New-Module {
#>
function Enable-OneShotListener {
$tempTask = "PortValhalla Temp";
$action = New-ScheduledTaskAction -Execute "pwsh" -Argument (Get-StartupArguments);
$action = New-ScheduledTaskAction -Execute "pwsh" -Argument ([string](Get-StartupArguments));
schtasks /Create /SC ONEVENT /EC $logName /MO "*[System[Provider[@Name='$logName'] and EventID=$($oneShotTrigger)]]" /TR cmd.exe /TN $tempTask;
$trigger = (Get-ScheduledTask $tempTask).Triggers;
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest;