Skip to content

Commit

Permalink
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
Browse files Browse the repository at this point in the history
…onScript
  • Loading branch information
sebassem committed Jul 18, 2024
1 parent 78d087c commit fa8ad62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions azure_jumpstart_arcbox/artifacts/RunAfterClientVMADJoin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ $cimsession = New-CimSession -Credential $adminCredential

# Creating scheduled task for WinGet.ps1
$Trigger = New-ScheduledTaskTrigger -AtLogOn -User $adminuser
$Trigger2 = New-ScheduledTaskTrigger -AtLogOn -CimSession $cimsession
#$Trigger2 = New-ScheduledTaskTrigger -AtLogOn -CimSession $cimsession
$Action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument $Env:ArcBoxDir\WinGet.ps1
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -RunOnlyIfNetworkAvailable -NetworkName "Any"
$principal = New-ScheduledTaskPrincipal -RunLevel Highest -GroupId "BUILTIN\Administrators"
#$principal = New-ScheduledTaskPrincipal -RunLevel Highest -GroupId "BUILTIN\Administrators"

Register-ScheduledTask -TaskName "WinGetLogonScript" -Trigger $Trigger -CimSession $cimsession -Action $Action -RunLevel "Highest" -Force -Settings $settings
Register-ScheduledTask -TaskName "WinGetLogonScript2" -Trigger $Trigger2 -Principal $principal -Action $Action -Force -Settings $settings
#Register-ScheduledTask -TaskName "WinGetLogonScript2" -Trigger $Trigger2 -Principal $principal -Action $Action -Force -Settings $settings

# Creating scheduled task for DataOpsLogonScript.ps1
$Action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument "$Env:ArcBoxDir\DataOpsLogonScript.ps1"
Expand Down

0 comments on commit fa8ad62

Please sign in to comment.