Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arcbox 3.0 - Fix scheduled task #2615

Merged
merged 20 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
fa15d50
wait for network
sebassem Jul 17, 2024
9039e2a
Refactor script to set SyncForegroundPolicy after joining domain
sebassem Jul 17, 2024
5abf010
Refactor script to set SyncForegroundPolicy after joining domain
sebassem Jul 17, 2024
9ac1235
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 17, 2024
d591ee0
testing
sebassem Jul 17, 2024
f95374f
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 17, 2024
480e1f8
Refactor script to set user principal name after joining domain
sebassem Jul 17, 2024
2d5e674
Refactor script to set user principal name after joining domain
sebassem Jul 17, 2024
222947d
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 17, 2024
4964bb6
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 17, 2024
3b8d563
Refactor script to set SyncForegroundPolicy after joining domain
sebassem Jul 18, 2024
deefd71
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 18, 2024
80ea21f
Refactor script to set SyncForegroundPolicy after joining domain
sebassem Jul 18, 2024
4115c5d
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 18, 2024
4ced107
testing
sebassem Jul 18, 2024
9d034d4
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 18, 2024
6974e9d
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 18, 2024
78d087c
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 18, 2024
fa8ad62
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 18, 2024
0d41dcc
Refactor scheduled task creation for WinGetLogonScript and DataOpsLog…
sebassem Jul 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions azure_jumpstart_arcbox/artifacts/Bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ if ([bool]$vmAutologon) {
}
}

# Set SyncForegroundPolicy to 1 to ensure that the scheduled task runs after the client VM joins the domain
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" "SyncForegroundPolicy" 1

# Copy PowerShell Profile and Reload
Invoke-WebRequest ($templateBaseUrl + "artifacts/PSProfile.ps1") -OutFile $PsHome\Profile.ps1
.$PsHome\Profile.ps1
Expand Down
7 changes: 5 additions & 2 deletions azure_jumpstart_arcbox/artifacts/RunAfterClientVMADJoin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ Write-Host "===================================================="
$cimsession = New-CimSession -Credential $adminCredential

# Creating scheduled task for WinGet.ps1
$Trigger = New-ScheduledTaskTrigger -AtLogOn
$Trigger = New-ScheduledTaskTrigger -AtLogOn -User $adminuser
$Action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument $Env:ArcBoxDir\WinGet.ps1
Register-ScheduledTask -TaskName "WinGetLogonScript" -Trigger $Trigger -CimSession $cimsession -Action $Action -RunLevel "Highest" -Force
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -RunOnlyIfNetworkAvailable -NetworkName "Any"
Register-ScheduledTask -TaskName "WinGetLogonScript" -Trigger $Trigger -CimSession $cimsession -Action $Action -RunLevel "Highest" -Force -Settings $settings

# Creating scheduled task for DataOpsLogonScript.ps1
$Action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument "$Env:ArcBoxDir\DataOpsLogonScript.ps1"
Expand All @@ -64,4 +65,6 @@ net user $account /active:no
# Delete schedule task
schtasks.exe /delete /f /tn RunAfterClientVMADJoin

Restart-Computer -Force

Stop-Transcript
Loading