Minor changes

pull/2/head
Romanitho 2022-01-22 16:44:48 +01:00 committed by GitHub
parent e0608b295b
commit aee6f711d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 33 deletions

View File

@ -1,6 +1,8 @@
#Create winget-update folder and content structure
$WingetUpdatePath = "$env:ProgramData\winget-update"
Write-host "Instaling to $WingetUpdatePath\"
try{
#Copy files to location
if (!(Test-Path $WingetUpdatePath)){
New-Item -ItemType Directory -Force -Path $WingetUpdatePath
@ -9,8 +11,8 @@ Copy-Item -Path "$PSScriptRoot\winget-update\*" -Destination $WingetUpdatePath -
Copy-Item -Path "$PSScriptRoot\excluded_apps.txt" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
# Set dummy regkeys for notification name and icon
& reg add "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /v DisplayName /t REG_EXPAND_SZ /d "Application Update" /f
& 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 DisplayName /t REG_EXPAND_SZ /d "Application Update" /f | Out-Null
& reg add "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /v IconUri /t REG_EXPAND_SZ /d %SystemRoot%\system32\@WindowsUpdateToastIcon.png /f | Out-Null
# Settings for the scheduled task for Updates
$taskAction = New-ScheduledTaskAction Execute "powershell.exe" -Argument "-ExecutionPolicy Bypass -File `"$($WingetUpdatePath)\winget-upgrade.ps1`""
@ -34,3 +36,10 @@ Register-ScheduledTask -TaskName 'Winget Update Notify' -InputObject $task -Forc
# Run Winget
Get-ScheduledTask -TaskName "Winget Update" -ErrorAction SilentlyContinue | Start-ScheduledTask -ErrorAction SilentlyContinue
Write-host "Installation succeeded!" -ForegroundColor Green
Start-sleep 5
}
catch{
Write-host "Installation failed! Run me with admin rights" -ForegroundColor Red
Start-sleep 5
}