Install location variable

Editable install source
pull/2/head
Romanitho 2022-01-18 14:12:18 +01:00 committed by GitHub
parent aff33efcb0
commit b1c468117a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,7 @@
#Create winget-update folder and content #Create winget-update folder and content structure
$WingetUpdatePath = "$env:ProgramData\winget-update" $WingetUpdatePath = "$env:ProgramData\winget-update"
#Copy files to location
if (!(Test-Path $WingetUpdatePath)){ if (!(Test-Path $WingetUpdatePath)){
New-Item -ItemType Directory -Force -Path $WingetUpdatePath New-Item -ItemType Directory -Force -Path $WingetUpdatePath
} }
@ -11,7 +13,7 @@ Copy-Item -Path "$PSScriptRoot\excluded_apps.txt" -Destination $WingetUpdatePath
& reg add "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /v IconUri /t REG_EXPAND_SZ /d %SystemRoot%\system32\@WindowsUpdateToastIcon.png /f & reg add "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /v IconUri /t REG_EXPAND_SZ /d %SystemRoot%\system32\@WindowsUpdateToastIcon.png /f
# Settings for the scheduled task for Updates # Settings for the scheduled task for Updates
$taskAction = New-ScheduledTaskAction Execute "powershell.exe" -Argument '-ExecutionPolicy Bypass -File "C:\ProgramData\winget-update\winget-upgrade.ps1"' $taskAction = New-ScheduledTaskAction Execute "powershell.exe" -Argument "-ExecutionPolicy Bypass -File `"$($WingetUpdatePath)\winget-upgrade.ps1`""
$taskTrigger1 = New-ScheduledTaskTrigger -AtLogOn $taskTrigger1 = New-ScheduledTaskTrigger -AtLogOn
$taskTrigger2 = New-ScheduledTaskTrigger -Daily -At 6AM $taskTrigger2 = New-ScheduledTaskTrigger -Daily -At 6AM
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId 'SYSTEM' -RunLevel Highest $taskUserPrincipal = New-ScheduledTaskPrincipal -UserId 'SYSTEM' -RunLevel Highest
@ -22,7 +24,7 @@ $task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Set
Register-ScheduledTask -TaskName 'Winget Update' -InputObject $task -Force Register-ScheduledTask -TaskName 'Winget Update' -InputObject $task -Force
# Settings for the scheduled task for Notifications # Settings for the scheduled task for Notifications
$taskAction = New-ScheduledTaskAction Execute "wscript.exe" -Argument '"C:\ProgramData\winget-update\Invisible.vbs" "powershell.exe -ExecutionPolicy Bypass -File C:\ProgramData\winget-update\winget-notify.ps1"' $taskAction = New-ScheduledTaskAction Execute "wscript.exe" -Argument "`"$($WingetUpdatePath)\Invisible.vbs`" `"powershell.exe -ExecutionPolicy Bypass -File `"`"`"$($WingetUpdatePath)\winget-notify.ps1`"`""
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-32-545 $taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-32-545
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 00:05:00 $taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 00:05:00