From 5290d3283a3b2eb80c9b32e79525176fa844e59b Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 22 Mar 2024 15:25:00 +0100 Subject: [PATCH] Replace C# invocations with `Invoke-Command` --- scripts/Windows/OS/User/Add.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Windows/OS/User/Add.ps1 b/scripts/Windows/OS/User/Add.ps1 index f4b5a4dc..b93d49d3 100644 --- a/scripts/Windows/OS/User/Add.ps1 +++ b/scripts/Windows/OS/User/Add.ps1 @@ -83,11 +83,11 @@ function Enable-UACNextLogin([Context] $context) { [System.Tuple]::Create( $autoLoginTrigger, $autoLoginName, - "{ $((Get-AutoLoginScript)) }.Invoke($autoLoginTrigger, '$contextScript', '$preparedUsernameProperty', '$preparedPasswordProperty')") + "Invoke-Command { $((Get-AutoLoginScript)) } -ArgumentList @($autoLoginTrigger, '$contextScript', '$preparedUsernameProperty', '$preparedPasswordProperty')") [System.Tuple]::Create( $uacDisablerTrigger, $uacDisablerName, - "{ $((Get-UACDisablerScript)) }.Invoke($uacDisablerTrigger, '$contextScript', '$autoLoginName', '$uacDisablerName', '$autoLoginTriggerProperty', '$uacDisablerTriggerProperty')")); + "Invoke-Command { $((Get-UACDisablerScript)) } -ArgumentList @($uacDisablerTrigger, '$contextScript', '$autoLoginName', '$uacDisablerName', '$autoLoginTriggerProperty', '$uacDisablerTriggerProperty')")); foreach ($options in $optionCollection) { $action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument (