Refactor the creation of scheduled tasks
This commit is contained in:
parent
24febb32f8
commit
5d914ce33f
1 changed files with 24 additions and 2 deletions
|
@ -83,11 +83,33 @@ function Enable-UACNextLogin([Context] $context) {
|
||||||
[System.Tuple]::Create(
|
[System.Tuple]::Create(
|
||||||
$autoLoginTrigger,
|
$autoLoginTrigger,
|
||||||
$autoLoginName,
|
$autoLoginName,
|
||||||
"Invoke-Command { $((Get-AutoLoginScript)) } -ArgumentList @($autoLoginTrigger, '$contextScript', '$preparedUsernameProperty', '$preparedPasswordProperty')")
|
[string]::Join(
|
||||||
|
"`n",
|
||||||
|
@(
|
||||||
|
"{",
|
||||||
|
" Invoke-Command { $((Get-AutoLoginScript)) } -ArgumentList @(",
|
||||||
|
" $autoLoginTrigger,",
|
||||||
|
" '$contextScript',",
|
||||||
|
" '$preparedUsernameProperty',",
|
||||||
|
" '$preparedPasswordProperty'",
|
||||||
|
" )",
|
||||||
|
"}")))
|
||||||
[System.Tuple]::Create(
|
[System.Tuple]::Create(
|
||||||
$uacDisablerTrigger,
|
$uacDisablerTrigger,
|
||||||
$uacDisablerName,
|
$uacDisablerName,
|
||||||
"Invoke-Command { $((Get-UACDisablerScript)) } -ArgumentList @($uacDisablerTrigger, '$contextScript', '$autoLoginName', '$uacDisablerName', '$autoLoginTriggerProperty', '$uacDisablerTriggerProperty')"));
|
[string]::Join(
|
||||||
|
"`n",
|
||||||
|
@(
|
||||||
|
"{",
|
||||||
|
" Invoke-Command { $((Get-UACDisablerScript)) } -ArgumentList @(",
|
||||||
|
" $uacDisablerTrigger,",
|
||||||
|
" '$contextScript',",
|
||||||
|
" '$autoLoginName',",
|
||||||
|
" '$uacDisablerName',",
|
||||||
|
" '$autoLoginTriggerProperty',",
|
||||||
|
" '$uacDisablerTriggerProperty'",
|
||||||
|
" )",
|
||||||
|
"}"))));
|
||||||
|
|
||||||
foreach ($options in $optionCollection) {
|
foreach ($options in $optionCollection) {
|
||||||
$action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument (
|
$action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument (
|
||||||
|
|
Loading…
Reference in a new issue