Review code for MSI creation

pull/696/head
Romain 2024-09-13 22:06:18 +02:00
parent 8113b754f9
commit cb192a6146
20 changed files with 843 additions and 2098 deletions

View File

@ -1,125 +0,0 @@
---
name: WAU - Auto Create Pre-Release Version
on:
schedule:
- cron: "0 0 * * *"
permissions:
contents: write
jobs:
check_merged:
name: Compare latest merge and tag
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.should_run.outputs.SHOULD_RUN }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if latest merged is older than latest tag
id: should_run
run: |
echo "Latest tag:"
git log --tags --pretty="%ci - %h - %s %d" -n 1
LATEST_TAG_DATE=$(git log --tags -n 1 --pretty="%ct")
echo $LATEST_TAG_DATE
echo "Latest merge:"
git log --merges --pretty="%ci - %h - %s %d" -n 1
LATEST_MERGE_DATE=$(git log --merges -n 1 --pretty="%ct")
echo $LATEST_MERGE_DATE
if [[ $LATEST_MERGE_DATE -gt $LATEST_TAG_DATE ]]; then
echo "Latest tag is older than latest merge. Nightly will be created."
echo "SHOULD_RUN=true" >> $GITHUB_OUTPUT
else
echo "Latest merge is not older than latest tag. No new release needed."
echo "SHOULD_RUN=false" >> $GITHUB_OUTPUT
fi
build:
name: Create Release Asset
needs: [check_merged]
if: ${{ needs.check_merged.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: "true"
fetch-depth: 0
- name: Auto Increment Semver Action
uses: MCKanpolat/auto-semver-action@5003b8d37f4b03d95f15303ea10242cbf7c13141 # 2
id: versioning
with:
releaseType: Patch
incrementPerCommit: false
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Next Release Number
id: WAU_version
run: |
echo "Next Release version: ${{ steps.versioning.outputs.version }}"
- name: Overwrite Version.txt file
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3
with:
path: Sources/Winget-AutoUpdate/Version.txt
write-mode: overwrite
contents: ${{ steps.versioning.outputs.version }}
- name: Commit & Push
uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 # v1.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
force: true
message: "Changed version to ${{ steps.versioning.outputs.version }}"
- name: Build project
run: |
echo "### Get MDT from Microsoft ###"
wget https://download.microsoft.com/download/3/3/9/339BE62D-B4B8-4956-B58D-73C4685FC492/MicrosoftDeploymentToolkit_x64.msi
echo "### Extract MSI ###"
7z x MicrosoftDeploymentToolkit_x64.msi
echo "### Copy ServiceUI.exe to 'Sources/Winget-AutoUpdate' folder ###"
mv Modena_File206 Sources/Winget-AutoUpdate/ServiceUI.exe -v
echo "### Go to Sources ###"
cd Sources
echo "### Zip WAU ###"
zip -r ../WAU.zip Winget-AutoUpdate
zip ../WAU.zip Winget-AutoUpdate-Install.ps1
echo "### Zip WAU-Configurator ###"
zip -r ../WAU-Configurator.zip Winget-AutoUpdate
zip ../WAU-Configurator.zip "Winget-AutoUpdate-Install.ps1"
zip ../WAU-Configurator.zip "WAU Configurator.bat"
echo "### Zip ADMX ###"
cd Policies
zip -r ../../WAU_ADMX.zip *
cd ../..
echo "### Create install counter file ###"
echo "Install counter file." > WAU_InstallCounter
- name: Create release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
id: release
with:
tag: "v${{ steps.versioning.outputs.version }}"
prerelease: true
generateReleaseNotes: true
name: "v${{ steps.versioning.outputs.version }} [Nightly Build]"
artifacts: "WAU-Configurator.zip,WAU.zip,WAU_ADMX.zip,WAU_InstallCounter"
- name: URL to release
run: echo "Release -> ${{ steps.release.outputs.html_url }}"

View File

@ -1,94 +0,0 @@
---
name: WAU - Create New Version
on:
workflow_dispatch:
inputs:
version:
type: choice
default: "Patch"
description: Select next release type
options:
- Patch
- Minor
- Major
required: true
pre-release:
type: boolean
description: Set as Pre-release version
permissions:
contents: write
jobs:
build:
name: Create Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: "true"
- name: Auto Increment Semver Action
uses: MCKanpolat/auto-semver-action@5003b8d37f4b03d95f15303ea10242cbf7c13141 # 2
id: versioning
with:
releaseType: ${{ github.event.inputs.version }}
incrementPerCommit: false
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Overwrite Version.txt file
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 # v1.3
with:
path: Sources/Winget-AutoUpdate/Version.txt
write-mode: overwrite
contents: "${{ steps.versioning.outputs.version }}"
- name: Commit & Push
uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 # v1.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
force: true
message: "Changed version to ${{ steps.versioning.outputs.version }}"
- name: Build project
run: |
echo "### Get MDT from Microsoft ###"
wget https://download.microsoft.com/download/3/3/9/339BE62D-B4B8-4956-B58D-73C4685FC492/MicrosoftDeploymentToolkit_x64.msi
echo "### Extract MSI ###"
7z x MicrosoftDeploymentToolkit_x64.msi
echo "### Copy ServiceUI.exe to 'Sources/Winget-AutoUpdate' folder ###"
mv Modena_File206 Sources/Winget-AutoUpdate/ServiceUI.exe -v
echo "### Go to Sources ###"
cd Sources
echo "### Zip WAU ###"
zip -r ../WAU.zip Winget-AutoUpdate
zip ../WAU.zip Winget-AutoUpdate-Install.ps1
echo "### Zip WAU-Configurator ###"
zip -r ../WAU-Configurator.zip Winget-AutoUpdate
zip ../WAU-Configurator.zip "Winget-AutoUpdate-Install.ps1"
zip ../WAU-Configurator.zip "WAU Configurator.bat"
echo "### Zip ADMX ###"
cd Policies
zip -r ../../WAU_ADMX.zip *
cd ../..
echo "### Create install counter file ###"
echo "Install counter file." > WAU_InstallCounter
- name: Create release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
tag: "v${{ steps.versioning.outputs.version }}"
prerelease: ${{ github.event.inputs.pre-release }}
generateReleaseNotes: true
name: "v${{ steps.versioning.outputs.version }}"
artifacts: "WAU-Configurator.zip,WAU.zip,WAU_ADMX.zip,WAU_InstallCounter"

156
.github/workflows/WAU-ReleaseBuilder.yml vendored Normal file
View File

@ -0,0 +1,156 @@
---
name: WAU - Release builder
on:
# To trigger nightly release (Auto)
schedule:
- cron: "*/5 * * * *"
# To trigger stable release
workflow_dispatch:
inputs:
version:
type: choice
default: "Minor"
description: Select next release type
options:
- Patch
- Minor
- Major
required: true
pre-release:
type: boolean
description: Set as Pre-release version
permissions:
contents: write
jobs:
build:
name: Create Release
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: "true"
fetch-depth: 0
- name: Manually OR Scheduled. If Scheduled, check if release is necessary
run: |
if ("${{ github.event_name }}" -eq "schedule") {
echo "Latest tag:"
git log --tags --pretty="%ci - %h - %s %d" -n 1
$LATEST_TAG_DATE = git log --tags -n 1 --pretty="%ct"
echo $LATEST_TAG_DATE
echo "Latest merge:"
git log --merges --pretty="%ci - %h - %s %d" -n 1
$LATEST_MERGE_DATE = git log --merges -n 1 --pretty="%ct"
echo $LATEST_MERGE_DATE
if ( $LATEST_MERGE_DATE -gt $LATEST_TAG_DATE ) {
echo "Scheduled request. Latest tag is older than latest merge. Nightly prerelease will be created."
echo "ReleaseType=Prerelease" >> $env:GITHUB_ENV
}
else {
echo "Scheduled request. Latest tag is not older than latest merge. No new Nightly release needed."
echo "ReleaseType=No" >> $env:GITHUB_ENV
}
}
else {
echo "Manual request. Release will be created."
echo "ReleaseType=Release" >> $env:GITHUB_ENV
}
- name: Auto Increment Semver Action
uses: MCKanpolat/auto-semver-action@5003b8d37f4b03d95f15303ea10242cbf7c13141 # 2
if: env.ReleaseType != 'No'
id: versioning
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
incrementPerCommit: false
releaseType: Pre${{ github.event.inputs.version || 'patch'}} # Using Prepatch by default
- name: Format Semver (and msi version)
if: env.ReleaseType != 'No'
# Remove "-0" for stable release and replace by "-n" for Nightlies
run: |
$NextAutoSemver = "${{ steps.versioning.outputs.version }}"
if ("${{ env.ReleaseType }}" -eq "Release") {
$MsiVersion = $NextAutoSemver.Split("-")[0]
$NextSemver = $NextAutoSemver.Split("-")[0]
$ReleaseName = $NextSemver
$Prerelease = 0
}
else {
$MsiVersion = $NextAutoSemver.Split("-")[0]
$NextSemver = $NextAutoSemver.Replace("-0","-n")
$ReleaseName = $NextSemver + " [Nightly Build]"
$Prerelease = 1
}
echo "MSI version: $MsiVersion"
echo "Semver created: $NextSemver"
echo "Prerelease: $Prerelease"
echo "Release name: $ReleaseName"
echo "MsiVersion=$MsiVersion" >> $env:GITHUB_ENV
echo "NextSemVer=$NextSemVer" >> $env:GITHUB_ENV
echo "Prerelease=$Prerelease" >> $env:GITHUB_ENV
echo "ReleaseName=$ReleaseName" >> $env:GITHUB_ENV
- name: Build project
if: env.ReleaseType != 'No'
shell: powershell
run: |
echo "### Get MDT from Microsoft ###"
wget https://download.microsoft.com/download/3/3/9/339BE62D-B4B8-4956-B58D-73C4685FC492/MicrosoftDeploymentToolkit_x64.msi -UseBasicParsing -OutFile .\MicrosoftDeploymentToolkit_x64.msi
Start-Process .\MicrosoftDeploymentToolkit_x64.msi -ArgumentList "/quiet /norestart" -Wait
echo "### Copy ServiceUI.exe x64 to 'Sources\Winget-AutoUpdate' folder ###"
Copy-Item -Path "C:\Program Files\Microsoft Deployment Toolkit\Templates\Distribution\Tools\x64\ServiceUI.exe" -Destination ".\Sources\Winget-AutoUpdate\ServiceUI.exe" -Force
Get-Item .\Sources\Winget-AutoUpdate\*
echo "### Install WiX ###"
dotnet new console
dotnet tool install --global wix --version 5.0.1
wix extension add WixToolset.UI.wixext/5.0.1 -g
wix extension add WixToolset.Util.wixext/5.0.1 -g
echo "### Create WAU msi ###"
cd .\Sources\Wix\
wix build -src build.wxs -ext WixToolset.Util.wixext -ext WixToolset.UI.wixext -out ..\..\WAU.msi -arch x64 -d Version=${{ env.MsiVersion }} -d NextSemVer=${{ env.NextSemVer }} -d Comment="${{ env.ReleaseName }}" -d PreRelease=${{ env.PreRelease }}
cd ..\..
Get-Item .\WAU.msi
echo "### Get MSI file SHA ###"
$MsiSHA = (Get-FileHash .\WAU.msi).hash
echo " - WAU.msi SHA256: $MsiSHA"
echo "MSI_SHA=$MsiSHA" >> $env:GITHUB_ENV
echo "### Zip ADMX ###"
Compress-Archive -Path .\Sources\Policies\ADMX -DestinationPath .\WAU_ADMX.zip -Force
Get-Item .\*.zip
echo "### Get ADMX zip SHA ###"
$ADMXSHA = (Get-FileHash .\WAU_ADMX.zip).hash
echo " - WAU_ADMX.zip SHA256: $ADMXSHA"
echo "ADMX_SHA=$ADMXSHA" >> $env:GITHUB_ENV
echo "### Create install counter file ###"
echo "Install counter file." > WAU_InstallCounter
- name: Create release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
if: env.ReleaseType != 'No'
with:
tag: v${{ env.NextSemVer }}
prerelease: ${{ github.event.inputs.pre-release || true }}
generateReleaseNotes: true
name: ${{ env.ReleaseName }}
artifacts: "WAU.msi,WAU_ADMX.zip,WAU_InstallCounter"
body: |
|Files|Hash (SHA256)|Downloads|
|---|---|---|
|[WAU.msi](https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v${{ env.NextSemVer }}/WAU.msi) (x64)|${{ env.MSI_SHA }}|<picture>![WAU.msi](https://img.shields.io/github/downloads/Romanitho/Winget-AutoUpdate/v${{ env.NextSemVer }}/WAU.msi?style=flat-square&label=&color=blue)</picture>|
|[WAU_ADMX.zip](https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v${{ env.NextSemVer }}/WAU_ADMX.zip)|${{ env.ADMX_SHA }}|<picture>![WAU_ADMX.zip](https://img.shields.io/github/downloads/Romanitho/Winget-AutoUpdate/v${{ env.NextSemVer }}/WAU_ADMX.zip?style=flat-square&label=&color=blue)</picture>|
<picture>![Install counter](https://img.shields.io/github/downloads/Romanitho/Winget-AutoUpdate/v${{ env.NextSemVer }}/WAU_InstallCounter?style=flat-square&label=Total%20reported%20installations%20for%20this%20release&color=blue)</picture>

File diff suppressed because one or more lines are too long

View File

@ -1,514 +0,0 @@
<#
.SYNOPSIS
Configure Winget to daily update installed apps.
.DESCRIPTION
Install powershell scripts and scheduled task to daily run Winget upgrade and notify connected users.
Posibility to exclude apps from auto-update
https://github.com/Romanitho/Winget-AutoUpdate
.PARAMETER Silent
Install Winget-AutoUpdate and prerequisites silently
.PARAMETER MaxLogFiles
Specify number of allowed log files (Default is 3 of 0-99: Setting MaxLogFiles to 0 don't delete any old archived log files, 1 keeps the original one and just let it grow)
.PARAMETER MaxLogSize
Specify the size of the log file in bytes before rotating. (Default is 1048576 = 1 MB)
.PARAMETER WAUinstallPath
Specify Winget-AutoUpdate installation localtion. Default: C:\ProgramData\Winget-AutoUpdate\
.PARAMETER DoNotUpdate
Do not run Winget-AutoUpdate after installation. By default, Winget-AutoUpdate is run just after installation.
.PARAMETER DisableWAUAutoUpdate
Disable Winget-AutoUpdate update checking. By default, WAU auto update if new version is available on Github.
.PARAMETER UseWhiteList
Use White List instead of Black List. This setting will not create the "exclude_apps.txt" but "include_apps.txt"
.PARAMETER ListPath
Get Black/White List from Path (URL/UNC/GPO/Local)
.PARAMETER ModsPath
Get mods from Path (URL/UNC/Local/AzureBlob)
.PARAMETER AzureBlobURL
Set the Azure Storage Blob URL including the SAS token. The token requires at a minimum 'Read' and 'List' permissions. It is recommended to set this at the container level
.PARAMETER Uninstall
Remove scheduled tasks and scripts.
.PARAMETER NoClean
Keep critical files when installing/uninstalling
.PARAMETER DesktopShortcut
Create a shortcut for user interaction on the Desktop to run task "Winget-AutoUpdate"
.PARAMETER StartMenuShortcut
Create shortcuts for user interaction in the Start Menu to run task "Winget-AutoUpdate", open Logs and Web Help
.PARAMETER NotificationLevel
Specify the Notification level: Full (Default, displays all notification), SuccessOnly (Only displays notification for success) or None (Does not show any popup).
.PARAMETER UpdatesAtLogon
Set WAU to run at user logon.
.PARAMETER UpdatesInterval
Specify the update frequency: Daily (Default), BiDaily, Weekly, BiWeekly, Monthly or Never
.PARAMETER UpdatesAtTime
Specify the time of the update interval execution time. Default 6AM
.PARAMETER RunOnMetered
Run WAU on metered connection. Default No.
.PARAMETER InstallUserContext
Install WAU with system and user context executions
.PARAMETER BypassListForUsers
Configure WAU to bypass the Black/White list when run in user context. Applications installed in system context will be ignored under user context.
.EXAMPLE
.\Winget-AutoUpdate-Install.ps1 -Silent -DoNotUpdate -MaxLogFiles 4 -MaxLogSize 2097152
.EXAMPLE
.\Winget-AutoUpdate-Install.ps1 -Silent -UseWhiteList
.EXAMPLE
.\Winget-AutoUpdate-Install.ps1 -Silent -ListPath https://www.domain.com/WAULists -StartMenuShortcut -UpdatesInterval BiDaily
.EXAMPLE
.\Winget-AutoUpdate-Install.ps1 -Silent -ModsPath https://www.domain.com/WAUMods -DesktopShortcut -UpdatesInterval Weekly
.EXAMPLE
.\Winget-AutoUpdate-Install.ps1 -Silent -UpdatesAtLogon -UpdatesInterval Weekly
.EXAMPLE
.\Winget-AutoUpdate-Install.ps1 -Silent -Uninstall -NoClean
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $False)] [Alias('S')] [Switch] $Silent = $false,
[Parameter(Mandatory = $False)] [Alias('Path', 'WingetUpdatePath')] [String] $WAUinstallPath = "$env:ProgramData\Winget-AutoUpdate",
[Parameter(Mandatory = $False)] [Alias('List')] [String] $ListPath,
[Parameter(Mandatory = $False)] [Alias('Mods')] [String] $ModsPath,
[Parameter(Mandatory = $False)] [Alias('AzureBlobURL')] [String] $AzureBlobSASURL,
[Parameter(Mandatory = $False)] [Switch] $DoNotUpdate = $false,
[Parameter(Mandatory = $False)] [Switch] $DisableWAUAutoUpdate = $false,
[Parameter(Mandatory = $False)] [Switch] $RunOnMetered = $false,
[Parameter(Mandatory = $False)] [Switch] $Uninstall = $false,
[Parameter(Mandatory = $False)] [Switch] $NoClean = $false,
[Parameter(Mandatory = $False)] [Switch] $DesktopShortcut = $false,
[Parameter(Mandatory = $False)] [Switch] $StartMenuShortcut = $false,
[Parameter(Mandatory = $False)] [Switch] $UseWhiteList = $false,
[Parameter(Mandatory = $False)] [ValidateSet("Full", "SuccessOnly", "None")] [String] $NotificationLevel = "Full",
[Parameter(Mandatory = $False)] [Switch] $UpdatesAtLogon = $false,
[Parameter(Mandatory = $False)] [ValidateSet("Daily", "BiDaily", "Weekly", "BiWeekly", "Monthly", "Never")] [String] $UpdatesInterval = "Daily",
[Parameter(Mandatory = $False)] [DateTime] $UpdatesAtTime = ("06am"),
[Parameter(Mandatory = $False)] [Switch] $BypassListForUsers = $false,
[Parameter(Mandatory = $False)] [Switch] $InstallUserContext = $false,
[Parameter(Mandatory = $False)] [ValidateRange(0, 99)] [int32] $MaxLogFiles = 3,
[Parameter(Mandatory = $False)] [int64] $MaxLogSize = 1048576 # in bytes, default is 1048576 = 1 MB
)
<# FUNCTIONS #>
#Include external Functions
. "$PSScriptRoot\Winget-AutoUpdate\functions\Install-Prerequisites.ps1"
. "$PSScriptRoot\Winget-AutoUpdate\functions\Invoke-DirProtect.ps1"
. "$PSScriptRoot\Winget-AutoUpdate\functions\Update-WinGet.ps1"
. "$PSScriptRoot\Winget-AutoUpdate\functions\Update-StoreApps.ps1"
. "$PSScriptRoot\Winget-AutoUpdate\functions\Add-Shortcut.ps1"
. "$PSScriptRoot\Winget-AutoUpdate\functions\Write-ToLog.ps1"
function Install-WingetAutoUpdate {
Write-ToLog "Installing WAU $WAUVersion..." "Yellow"
try {
#Copy files to location
if (!(Test-Path "$WAUinstallPath\Winget-Upgrade.ps1")) {
Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WAUinstallPath -Recurse -Force -ErrorAction SilentlyContinue
Write-ToLog "-> Running fresh installation..."
}
elseif ($NoClean) {
#Keep critical files
Get-ChildItem -Path $WAUinstallPath -Exclude *.txt, mods, logs, icons | Remove-Item -Recurse -Force
Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WAUinstallPath -Exclude icons -Recurse -Force -ErrorAction SilentlyContinue #Exclude icons if personalized
Write-ToLog "-> Updating previous installation. Keeping critical existing files..."
}
else {
#Keep logs only
Get-ChildItem -Path $WAUinstallPath -Exclude logs | Remove-Item -Recurse -Force
Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WAUinstallPath -Recurse -Force -ErrorAction SilentlyContinue
Write-ToLog "-> Updating previous installation..."
}
#White List or Black List apps
if ($UseWhiteList) {
#If fresh install and "included_apps.txt" exists, copy the list to WAU
if ((!$NoClean) -and (Test-Path "$PSScriptRoot\included_apps.txt")) {
Copy-Item -Path "$PSScriptRoot\included_apps.txt" -Destination $WAUinstallPath -Recurse -Force -ErrorAction SilentlyContinue
Write-ToLog "-> Copied a brand new Whitelist."
}
#Else, only copy the "included_apps.txt" list if not existing in WAU
elseif (!(Test-Path "$WAUinstallPath\included_apps.txt")) {
Copy-Item -Path "$PSScriptRoot\included_apps.txt" -Destination $WAUinstallPath -Recurse -Force -ErrorAction SilentlyContinue
Write-ToLog "-> No Whitelist was existing. Copied from install sources."
}
}
else {
if (!$NoClean) {
Copy-Item -Path "$PSScriptRoot\excluded_apps.txt" -Destination $WAUinstallPath -Recurse -Force -ErrorAction SilentlyContinue
Write-ToLog "-> Copied brand new Blacklist."
}
elseif (!(Test-Path "$WAUinstallPath\excluded_apps.txt")) {
Copy-Item -Path "$PSScriptRoot\excluded_apps.txt" -Destination $WAUinstallPath -Recurse -Force -ErrorAction SilentlyContinue
Write-ToLog "-> No Blacklist was existing. Copied from install sources."
}
}
# 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 | Out-Null
& reg add "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /v IconUri /t REG_EXPAND_SZ /d %SystemRoot%\system32\@WindowsUpdateToastIcon.png /f | Out-Null
# Clean potential old install
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
# Settings for the scheduled task for Updates (System)
Write-ToLog "-> Installing WAU scheduled tasks"
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($WAUinstallPath)\winget-upgrade.ps1`""
$taskTriggers = @()
if ($UpdatesAtLogon) {
$tasktriggers += New-ScheduledTaskTrigger -AtLogOn
}
if ($UpdatesInterval -eq "Daily") {
$tasktriggers += New-ScheduledTaskTrigger -Daily -At $UpdatesAtTime
}
elseif ($UpdatesInterval -eq "BiDaily") {
$tasktriggers += New-ScheduledTaskTrigger -Daily -At $UpdatesAtTime -DaysInterval 2
}
elseif ($UpdatesInterval -eq "Weekly") {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $UpdatesAtTime -DaysOfWeek 2
}
elseif ($UpdatesInterval -eq "BiWeekly") {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 2
}
elseif ($UpdatesInterval -eq "Monthly") {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 4
}
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId S-1-5-18 -RunLevel Highest
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 03:00:00
# Set up the task, and register it
if ($taskTriggers) {
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings -Trigger $taskTriggers
}
else {
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
}
Register-ScheduledTask -TaskName 'Winget-AutoUpdate' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
# Settings for the scheduled task in User context
$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$($WAUinstallPath)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WAUinstallPath)\winget-upgrade.ps1`"`""
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 03:00:00
# Set up the task for user apps
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
# Settings for the scheduled task for Notifications
$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$($WAUinstallPath)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WAUinstallPath)\winget-notify.ps1`"`""
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 00:05:00
# Set up the task, and register it
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-Notify' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
# Settings for the GPO scheduled task
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($WAUinstallPath)\WAU-Policies.ps1`""
$tasktrigger = New-ScheduledTaskTrigger -Daily -At 6am
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId S-1-5-18 -RunLevel Highest
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 00:05:00
# Set up the task, and register it
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings -Trigger $taskTrigger
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-Policies' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
#Set task readable/runnable for all users
$scheduler = New-Object -ComObject "Schedule.Service"
$scheduler.Connect()
$task = $scheduler.GetFolder("WAU").GetTask("Winget-AutoUpdate")
$sec = $task.GetSecurityDescriptor(0xF)
$sec = $sec + '(A;;GRGX;;;AU)'
$task.SetSecurityDescriptor($sec, 0)
# Configure Reg Key
Write-ToLog "-> Setting Registry config"
New-Item $regPath -Force | Out-Null
New-ItemProperty $regPath -Name DisplayName -Value "Winget-AutoUpdate (WAU)" -Force | Out-Null
New-ItemProperty $regPath -Name DisplayIcon -Value "C:\Windows\System32\shell32.dll,-16739" -Force | Out-Null
New-ItemProperty $regPath -Name DisplayVersion -Value $WAUVersion -Force | Out-Null
New-ItemProperty $regPath -Name InstallLocation -Value $WAUinstallPath -Force | Out-Null
New-ItemProperty $regPath -Name UninstallString -Value "powershell.exe -noprofile -executionpolicy bypass -file `"$WAUinstallPath\WAU-Uninstall.ps1`"" -Force | Out-Null
New-ItemProperty $regPath -Name QuietUninstallString -Value "powershell.exe -noprofile -executionpolicy bypass -file `"$WAUinstallPath\WAU-Uninstall.ps1`"" -Force | Out-Null
New-ItemProperty $regPath -Name NoModify -Value 1 -Force | Out-Null
New-ItemProperty $regPath -Name NoRepair -Value 1 -Force | Out-Null
New-ItemProperty $regPath -Name Publisher -Value "Romanitho" -Force | Out-Null
New-ItemProperty $regPath -Name URLInfoAbout -Value "https://github.com/Romanitho/Winget-AutoUpdate" -Force | Out-Null
New-ItemProperty $regPath -Name WAU_NotificationLevel -Value $NotificationLevel -Force | Out-Null
New-ItemProperty $regPath -Name WAU_UpdatePrerelease -Value 0 -PropertyType DWord -Force | Out-Null
New-ItemProperty $regPath -Name WAU_PostUpdateActions -Value 0 -PropertyType DWord -Force | Out-Null
New-ItemProperty $regPath -Name WAU_MaxLogFiles -Value $MaxLogFiles -PropertyType DWord -Force | Out-Null
New-ItemProperty $regPath -Name WAU_MaxLogSize -Value $MaxLogSize -PropertyType DWord -Force | Out-Null
New-ItemProperty $regPath -Name WAU_UpdatesAtTime -Value $UpdatesAtTime -Force | Out-Null
New-ItemProperty $regPath -Name WAU_UpdatesInterval -Value $UpdatesInterval -Force | Out-Null
if ($UpdatesAtLogon) {
New-ItemProperty $regPath -Name WAU_UpdatesAtLogon -Value 1 -PropertyType DWord -Force | Out-Null
}
if ($DisableWAUAutoUpdate) {
New-ItemProperty $regPath -Name WAU_DisableAutoUpdate -Value 1 -Force | Out-Null
}
if ($UseWhiteList) {
New-ItemProperty $regPath -Name WAU_UseWhiteList -Value 1 -PropertyType DWord -Force | Out-Null
}
if (!$RunOnMetered) {
New-ItemProperty $regPath -Name WAU_DoNotRunOnMetered -Value 1 -PropertyType DWord -Force | Out-Null
}
if ($ListPath) {
New-ItemProperty $regPath -Name WAU_ListPath -Value $ListPath -Force | Out-Null
}
if ($ModsPath) {
New-ItemProperty $regPath -Name WAU_ModsPath -Value $ModsPath -Force | Out-Null
}
if ($AzureBlobSASURL) {
New-ItemProperty $regPath -Name WAU_AzureBlobSASURL -Value $AzureBlobSASURL -Force | Out-Null
}
if ($BypassListForUsers) {
New-ItemProperty $regPath -Name WAU_BypassListForUsers -Value 1 -PropertyType DWord -Force | Out-Null
}
if ($InstallUserContext) {
New-ItemProperty $regPath -Name WAU_UserContext -Value 1 -PropertyType DWord -Force | Out-Null
}
if ($DesktopShortcut) {
New-ItemProperty $regPath -Name WAU_DesktopShortcut -Value 1 -PropertyType DWord -Force | Out-Null
}
if ($StartMenuShortcut) {
New-ItemProperty $regPath -Name WAU_StartMenuShortcut -Value 1 -PropertyType DWord -Force | Out-Null
}
#Security check
Write-ToLog "-> Checking Mods Directory:"
$Protected = Invoke-DirProtect "$WAUinstallPath\mods"
if ($Protected -eq $True) {
Write-ToLog " The mods directory is secured!" "Cyan"
}
else {
Write-ToLog " Error: The mods directory couldn't be verified as secured!" "Red"
}
Write-ToLog "-> Checking Functions Directory:"
$Protected = Invoke-DirProtect "$WAUinstallPath\Functions"
if ($Protected -eq $True) {
Write-ToLog " The Functions directory is secured!" "Cyan"
}
else {
Write-ToLog " Error: The Functions directory couldn't be verified as secured!" "Red"
}
#Create Shortcuts
if ($StartMenuShortcut) {
if (!(Test-Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)")) {
New-Item -ItemType Directory -Force -Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)" | Out-Null
}
Add-Shortcut "wscript.exe" "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)\WAU - Check for updated Apps.lnk" "`"$($WAUinstallPath)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WAUinstallPath)\user-run.ps1`"`"" "${env:SystemRoot}\System32\shell32.dll,-16739" "Manual start of Winget-AutoUpdate (WAU)..."
Add-Shortcut "wscript.exe" "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)\WAU - Open logs.lnk" "`"$($WAUinstallPath)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WAUinstallPath)\user-run.ps1`" -Logs`"" "${env:SystemRoot}\System32\shell32.dll,-16763" "Open existing WAU logs..."
Add-Shortcut "wscript.exe" "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)\WAU - Web Help.lnk" "`"$($WAUinstallPath)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WAUinstallPath)\user-run.ps1`" -Help`"" "${env:SystemRoot}\System32\shell32.dll,-24" "Help for WAU..."
}
if ($DesktopShortcut) {
Add-Shortcut "wscript.exe" "${env:Public}\Desktop\WAU - Check for updated Apps.lnk" "`"$($WAUinstallPath)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WAUinstallPath)\user-run.ps1`"`"" "${env:SystemRoot}\System32\shell32.dll,-16739" "Manual start of Winget-AutoUpdate (WAU)..."
}
#Add 1 to counter file
try {
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUVersion)/WAU_InstallCounter" | Out-Null
}
catch {
Write-ToLog "-> Not able to report installation." "Yellow"
}
Write-ToLog "-> WAU Installation succeeded!`n" "Green"
Start-sleep 1
#Run Winget ?
Start-WingetAutoUpdate
}
catch {
Write-ToLog "-> WAU Installation failed! Error $_ - Try running me with admin rights.`n" "Red"
Start-sleep 1
return $False
}
}
function Uninstall-WingetAutoUpdate {
Write-ToLog "Uninstalling WAU started!" "Yellow"
#Get registry install location
$InstallLocation = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation -ErrorAction SilentlyContinue
#Check if installed location exists and delete
if ($InstallLocation) {
try {
if (!$NoClean) {
Write-ToLog "-> Removing files and config."
Get-ChildItem -Path $InstallLocation -Exclude logs | Remove-Item -Force -Recurse
if (Test-Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log") {
Remove-Item -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log" -Force -ErrorAction SilentlyContinue | Out-Null
}
if (Test-Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-install.log") {
Remove-Item -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-install.log" -Force -ErrorAction SilentlyContinue | Out-Null
}
}
else {
#Keep critical files
Write-ToLog "-> Removing files. Keeping config."
Get-ChildItem -Path $InstallLocation -Exclude *.txt, mods, logs | Remove-Item -Recurse -Force
}
& reg delete "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /f | Out-Null
& reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" /f | Out-Null
if ((Test-Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)")) {
Remove-Item -Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)" -Recurse -Force | Out-Null
}
if ((Test-Path "${env:Public}\Desktop\WAU - Check for updated Apps.lnk")) {
Remove-Item -Path "${env:Public}\Desktop\WAU - Check for updated Apps.lnk" -Force | Out-Null
}
Write-ToLog "-> Removing scheduled tasks."
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Policies" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Write-ToLog "Uninstallation succeeded!`n" "Green"
Start-sleep 1
}
catch {
Write-ToLog "Uninstallation failed! Run as admin ?`n" "Red"
Start-sleep 1
}
}
else {
Write-ToLog "WAU is not installed!`n" "Red"
Start-sleep 1
}
}
function Start-WingetAutoUpdate {
#If -DoNotUpdate is true, skip.
if (!($DoNotUpdate)) {
#If -Silent, run Winget-AutoUpdate now
if ($Silent) {
$RunWinget = $True
}
#Ask for WingetAutoUpdate
else {
$MsgBoxTitle = "Winget-AutoUpdate"
$MsgBoxContent = "Would you like to run Winget-AutoUpdate now?"
$MsgBoxTimeOut = 60
$MsgBoxReturn = (New-Object -ComObject "Wscript.Shell").Popup($MsgBoxContent, $MsgBoxTimeOut, $MsgBoxTitle, 4 + 32)
if ($MsgBoxReturn -ne 7) {
$RunWinget = $True
}
}
if ($RunWinget) {
try {
Write-ToLog "Running Winget-AutoUpdate..." "Yellow"
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Start-ScheduledTask -ErrorAction SilentlyContinue
while ((Get-ScheduledTask -TaskName "Winget-AutoUpdate").State -ne 'Ready') {
Start-Sleep 1
}
}
catch {
Write-ToLog "Failed to run Winget-AutoUpdate..." "Red"
}
}
}
else {
Write-ToLog "Skip running Winget-AutoUpdate"
}
}
<# APP INFO #>
$WAUVersion = Get-Content "$PSScriptRoot\Winget-AutoUpdate\Version.txt" -ErrorAction SilentlyContinue
<# MAIN #>
#If running as a 32-bit process on an x64 system, re-launch as a 64-bit process
if ("$env:PROCESSOR_ARCHITEW6432" -ne "ARM64") {
if (Test-Path "$($env:WINDIR)\SysNative\WindowsPowerShell\v1.0\powershell.exe") {
Start-Process "$($env:WINDIR)\SysNative\WindowsPowerShell\v1.0\powershell.exe" -Wait -NoNewWindow -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command $($MyInvocation.line)"
Exit $lastexitcode
}
}
#Config console output encoding
$null = cmd /c '' #Tip for ISE
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# Workaround for ARM64 (Access Denied / Win32 internal Server error)
$Script:ProgressPreference = 'SilentlyContinue'
#Set install log file
$Script:LogFile = "$WAUinstallPath\logs\WAU-Installer.log"
Write-Host "`n "
Write-Host "`t 888 888 d8888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 o 888 d88888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 d8b 888 d88P888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 d888b 888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 888d88888b888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 88888P Y88888 d88P 888 888 888" -ForegroundColor Cyan
Write-Host "`t 8888P Y8888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 888P Y888 d88P 888 Y8888888P`n" -ForegroundColor Magenta
Write-Host "`t Winget-AutoUpdate $WAUVersion`n" -ForegroundColor Cyan
Write-Host "`t https://github.com/Romanitho/Winget-AutoUpdate`n" -ForegroundColor Magenta
Write-Host "`t________________________________________________________`n"
#Define WAU registry key
$Script:regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
if (!$Uninstall) {
Write-ToLog " INSTALLING WAU" -LogColor "Cyan" -IsHeader
Install-Prerequisites
$UpdateWinget = Update-Winget
if ($UpdateWinget -ne "fail") {
Install-WingetAutoUpdate
}
else {
Write-ToLog "Winget is mandatory to execute WAU." "Red"
}
}
else {
Write-ToLog " UNINSTALLING WAU" -LogColor "Cyan" -IsHeader
Uninstall-WingetAutoUpdate
}
if (Test-Path "$WAUinstallPath\Version.txt") {
Remove-Item "$WAUinstallPath\Version.txt" -Force
}
Write-ToLog "End of process." "Cyan"
Start-Sleep 3

View File

@ -3,26 +3,13 @@
Handle user interaction from shortcuts and show a Toast notification
.DESCRIPTION
Act on shortcut run (DEFAULT: Check for updated Apps)
.PARAMETER Logs
Open the Log file from Winget-AutoUpdate installation location
.PARAMETER Help
Open the Web Help page
https://github.com/Romanitho/Winget-AutoUpdate
Act on shortcut run
.EXAMPLE
.\user-run.ps1 -Logs
.\user-run.ps1
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $False)] [Switch] $Logs = $false,
[Parameter(Mandatory = $False)] [Switch] $Help = $false
)
function Test-WAUisRunning {
If (((Get-ScheduledTask -TaskName 'Winget-AutoUpdate').State -eq 'Running') -or ((Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext').State -eq 'Running')) {
Return $True
@ -45,22 +32,7 @@ Get-NotifLocale
$OnClickAction = "$WorkingDir\logs\updates.log"
$Button1Text = $NotifLocale.local.outputs.output[11].message
if ($Logs) {
if (Test-Path "$WorkingDir\logs\updates.log") {
Invoke-Item "$WorkingDir\logs\updates.log"
}
else {
#Not available yet
$Message = $NotifLocale.local.outputs.output[5].message
$MessageType = "warning"
Start-NotifTask -Message $Message -MessageType $MessageType -UserRun
}
}
elseif ($Help) {
Start-Process "https://github.com/Romanitho/Winget-AutoUpdate"
}
else {
try {
try {
#Check if WAU is currently running
if (Test-WAUisRunning) {
$Message = $NotifLocale.local.outputs.output[8].message
@ -92,11 +64,10 @@ else {
$Message = $NotifLocale.local.outputs.output[9].message
}
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss -UserRun
}
catch {
}
catch {
#Check failed - Just send notification
$Message = $NotifLocale.local.outputs.output[7].message
$MessageType = "error"
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss -UserRun
}
}

View File

@ -1 +0,0 @@
1.21.4

View File

@ -1,86 +0,0 @@
<#
.SYNOPSIS
Uninstall Winget-AutoUpdate
.DESCRIPTION
Uninstalls Winget-AutoUpdate (DEFAULT: clean old install)
https://github.com/Romanitho/Winget-AutoUpdate
.PARAMETER NoClean
Uninstall Winget-AutoUpdate (keep critical files)
.EXAMPLE
.\WAU-Uninstall.ps1 -NoClean
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $False)] [Switch] $NoClean = $false
)
Write-Host "`n"
Write-Host "`t 888 888 d8888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 o 888 d88888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 d8b 888 d88P888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 d888b 888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 888d88888b888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 88888P Y88888 d88P 888 888 888" -ForegroundColor Cyan
Write-Host "`t 8888P Y8888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 888P Y888 d88P 888 Y8888888P`n" -ForegroundColor Magenta
Write-Host "`t Winget-AutoUpdate`n" -ForegroundColor Cyan
Write-Host "`t https://github.com/Romanitho/Winget-AutoUpdate`n" -ForegroundColor Magenta
Write-Host "`t________________________________________________________`n`n"
try {
Write-host "Uninstalling WAU..." -ForegroundColor Yellow
#Get registry install location
$InstallLocation = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation
#Check if installed location exists and delete
if (Test-Path ($InstallLocation)) {
if (!$NoClean) {
Remove-Item "$InstallLocation\*" -Force -Recurse -Exclude "*.log"
}
else {
#Keep critical files
Get-ChildItem -Path $InstallLocation -Exclude *.txt, mods, logs | Remove-Item -Recurse -Force
}
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Policies" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
& reg delete "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /f | Out-Null
& reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" /f | Out-Null
if (Test-Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate") {
& reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" /f | Out-Null
}
if ((Test-Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)")) {
Remove-Item -Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)" -Recurse -Force | Out-Null
}
if ((Test-Path "${env:Public}\Desktop\WAU - Check for updated Apps.lnk")) {
Remove-Item -Path "${env:Public}\Desktop\WAU - Check for updated Apps.lnk" -Force | Out-Null
}
#Remove Intune Logs if they are existing
if (Test-Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log") {
Remove-Item -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log" -Force -ErrorAction SilentlyContinue | Out-Null
}
if (Test-Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-install.log") {
Remove-Item -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-install.log" -Force -ErrorAction SilentlyContinue | Out-Null
}
Write-host "Uninstallation succeeded!" -ForegroundColor Green
}
else {
Write-host "$InstallLocation not found! Uninstallation failed!" -ForegroundColor Red
}
}
catch {
Write-host "`nUninstallation failed! Run as admin ?" -ForegroundColor Red
}
Start-sleep 2

View File

@ -56,7 +56,6 @@ param(
#Include external Functions
. "$PSScriptRoot\functions\Install-Prerequisites.ps1"
. "$PSScriptRoot\functions\Update-WinGet.ps1"
. "$PSScriptRoot\functions\Update-StoreApps.ps1"
. "$PSScriptRoot\functions\Add-ScopeMachine.ps1"
. "$PSScriptRoot\functions\Get-WingetCmd.ps1"
@ -311,7 +310,7 @@ $CurrentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Pri
$Script:IsElevated = $CurrentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
#Get WAU Installed location
$WAURegKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\"
$WAURegKey = "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate\"
$Script:WAUInstallLocation = Get-ItemProperty $WAURegKey -ErrorAction SilentlyContinue | Select-Object -ExpandProperty InstallLocation
#LogPath initialization
@ -339,20 +338,6 @@ else {
$Script:LogFile = "$LogPath\install_$env:UserName.log"
}
#Header (not logged)
Write-Host "`n "
Write-Host "`t 888 888 d8888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 o 888 d88888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 d8b 888 d88P888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 d888b 888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 888d88888b888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 88888P Y88888 d88P 888 888 888" -ForegroundColor Cyan
Write-Host "`t 8888P Y8888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 888P Y888 d88P 888 Y8888888P`n" -ForegroundColor Magenta
Write-Host "`t Winget-AutoUpdate`n" -ForegroundColor Cyan
Write-Host "`t https://github.com/Romanitho/Winget-AutoUpdate`n" -ForegroundColor Magenta
Write-Host "`t________________________________________________________`n`n"
#Log Header
if ($Uninstall) {
Write-ToLog -LogMsg "NEW UNINSTALL REQUEST" -LogColor "Magenta" -IsHeader
@ -361,22 +346,23 @@ else {
Write-ToLog -LogMsg "NEW INSTALL REQUEST" -LogColor "Magenta" -IsHeader
}
#Get Winget command
$Script:Winget = Get-WingetCmd
if ($IsElevated -eq $True) {
Write-ToLog "Running with admin rights.`n"
#Check/install prerequisites
Install-Prerequisites
#Install/Update Winget
$null = Update-Winget
#Reload Winget command
$Script:Winget = Get-WingetCmd
#Run Scope Machine function
Add-ScopeMachine
}
else {
Write-ToLog "Running without admin rights.`n"
#Get Winget command
$Script:Winget = Get-WingetCmd
}
if ($Winget) {

View File

@ -33,10 +33,6 @@ if ($IsSystem) {
if (!(Test-Path -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log" -ErrorAction SilentlyContinue)) {
$symLink = New-Item -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log" -ItemType SymbolicLink -Value $LogFile -Force -ErrorAction SilentlyContinue
}
# Check if install.log and symlink WAU-install.log exists, make symlink (doesn't work under ServiceUI)
if ((Test-Path -Path ('{0}\logs\install.log' -f $WorkingDir) -ErrorAction SilentlyContinue) -and !(Test-Path -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-install.log" -ErrorAction SilentlyContinue)) {
$symLink = (New-Item -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-install.log" -ItemType SymbolicLink -Value ('{0}\logs\install.log' -f $WorkingDir) -Force -Confirm:$False -ErrorAction SilentlyContinue)
}
}
#Check if running with session ID 0
if ($SessionID -eq 0) {
@ -50,7 +46,8 @@ if ($IsSystem) {
$null = (New-Item "$WorkingDir\logs\symlink.txt" -Value $symLink -Force)
}
#Rerun WAU in system context with ServiceUI
& $WorkingDir\ServiceUI.exe -process:explorer.exe $env:windir\System32\wscript.exe \`"$WorkingDir\Invisible.vbs\`" \`"powershell.exe -NoProfile -ExecutionPolicy Bypass -File \`"\`"$WorkingDir\winget-upgrade.ps1\`"\`"\`"
Start-Process "ServiceUI.exe" -ArgumentList "-process:explorer.exe $env:windir\System32\conhost.exe --headless powershell.exe -NoProfile -ExecutionPolicy Bypass -File winget-upgrade.ps1" -WorkingDirectory $WorkingDir
Wait-Process "ServiceUI" -ErrorAction SilentlyContinue
Exit 0
}
else {
@ -126,19 +123,23 @@ Write-ToLog "Notification Level: $($WAUConfig.WAU_NotificationLevel). Notificati
#Check network connectivity
if (Test-Network) {
#Check prerequisites
if ($IsSystem) {
Install-Prerequisites
}
#Check if Winget is installed and get Winget cmd
$Script:Winget = Get-WingetCmd
if ($Winget) {
#Log Winget installed version
$WingetVer = & $Winget --version
Write-ToLog "Winget Version: $WingetVer"
if ($IsSystem) {
#Get Current Version
$WAUCurrentVersion = $WAUConfig.DisplayVersion
Write-ToLog "WAU current version: $WAUCurrentVersion"
if ($IsSystem) {
#Check if WAU update feature is enabled or not if run as System
$WAUDisableAutoUpdate = $WAUConfig.WAU_DisableAutoUpdate
#If yes then check WAU update if run as System
@ -375,25 +376,9 @@ if (Test-Network) {
}
#Check if user context is activated during system run
if ($IsSystem) {
if ($IsSystem -and ($WAUConfig.WAU_UserContext -eq 1)) {
#Run WAU in user context if feature is activated
if ($WAUConfig.WAU_UserContext -eq 1) {
#Create User context task if not existing
$UserContextTask = Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -ErrorAction SilentlyContinue
if (!$UserContextTask) {
#Create the scheduled task in User context
$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$($WAUConfig.InstallLocation)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WAUConfig.InstallLocation)\winget-upgrade.ps1`"`""
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 03:00:00
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
Write-ToLog "-> User Context task created."
#Load it
$UserContextTask = Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -ErrorAction SilentlyContinue
}
$explorerprocesses = @(Get-CimInstance -Query "SELECT * FROM Win32_Process WHERE Name='explorer.exe'" -ErrorAction SilentlyContinue)
If ($explorerprocesses.Count -eq 0) {
@ -411,7 +396,6 @@ if (Test-Network) {
}
}
}
}
else {
Write-ToLog "Critical: Winget not installed or detected, exiting..." "red"
New-Item "$WorkingDir\logs\error.txt" -Value "Winget not installed or detected" -Force

View File

@ -0,0 +1,173 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)] [string] $AppListPath,
[Parameter(Mandatory = $false)] [string] $InstallPath,
[Parameter(Mandatory = $false)] [string] $Upgrade,
[Parameter(Mandatory = $False)] [Switch] $Uninstall = $false
)
#For troubleshooting
Write-Output "AppListPath: $AppListPath"
Write-Output "InstallPath: $InstallPath"
Write-Output "Upgrade: $Upgrade"
Write-Output "Uninstall: $Uninstall"
<# FUNCTIONS #>
function Install-WingetAutoUpdate {
Write-Host "### Post install actions ###"
try {
# Clean potential old v1 install
$OldConfRegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
$OldWAUConfig = Get-ItemProperty $OldConfRegPath -ErrorAction SilentlyContinue
if ($OldWAUConfig.InstallLocation) {
Write-Host "-> Cleanning old v1 WAU version ($($OldWAUConfig.DisplayVersion))"
Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass -WindowStyle Hidden -File ""$($OldWAUConfig.InstallLocation)\WAU-Uninstall.ps1""" -Wait
}
#Get WAU config
$WAUconfig = Get-ItemProperty "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate"
Write-Output "-> WAU Config:"
Write-Output $WAUconfig
# Settings for the scheduled task for Updates (System)
Write-Host "-> Installing WAU scheduled tasks"
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($InstallPath)winget-upgrade.ps1`""
$taskTriggers = @()
if ($WAUconfig.WAU_UpdatesAtLogon -eq 1) {
$tasktriggers += New-ScheduledTaskTrigger -AtLogOn
}
if ($WAUconfig.WAU_UpdatesInterval -eq "Daily") {
$tasktriggers += New-ScheduledTaskTrigger -Daily -At $WAUconfig.WAU_UpdatesAtTime
}
elseif ($WAUconfig.WAU_UpdatesInterval -eq "BiDaily") {
$tasktriggers += New-ScheduledTaskTrigger -Daily -At $WAUconfig.WAU_UpdatesAtTime -DaysInterval 2
}
elseif ($WAUconfig.WAU_UpdatesInterval -eq "Weekly") {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUconfig.WAU_UpdatesAtTime -DaysOfWeek 2
}
elseif ($WAUconfig.WAU_UpdatesInterval -eq "BiWeekly") {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUconfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 2
}
elseif ($WAUconfig.WAU_UpdatesInterval -eq "Monthly") {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUconfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 4
}
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId S-1-5-18 -RunLevel Highest
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 03:00:00
# Set up the task, and register it
if ($taskTriggers) {
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings -Trigger $taskTriggers
}
else {
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
}
Register-ScheduledTask -TaskName 'Winget-AutoUpdate' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
# Settings for the scheduled task in User context
$taskAction = New-ScheduledTaskAction -Execute "conhost.exe" -Argument "--headless powershell.exe -NoProfile -ExecutionPolicy Bypass -File winget-upgrade.ps1" -WorkingDirectory $InstallPath
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 03:00:00
# Set up the task for user apps
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
# Settings for the scheduled task for Notifications
$taskAction = New-ScheduledTaskAction -Execute "conhost.exe" -Argument "--headless powershell.exe -NoProfile -ExecutionPolicy Bypass -File winget-notify.ps1" -WorkingDirectory $InstallPath
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 00:05:00
# Set up the task, and register it
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-Notify' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
# Settings for the GPO scheduled task
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($InstallPath)WAU-Policies.ps1`""
$tasktrigger = New-ScheduledTaskTrigger -Daily -At 6am
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId S-1-5-18 -RunLevel Highest
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 00:05:00
# Set up the task, and register it
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings -Trigger $taskTrigger
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-Policies' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
#Set task readable/runnable for all users
$scheduler = New-Object -ComObject "Schedule.Service"
$scheduler.Connect()
$task = $scheduler.GetFolder("WAU").GetTask("Winget-AutoUpdate")
$sec = $task.GetSecurityDescriptor(0xF)
$sec = $sec + '(A;;GRGX;;;AU)'
$task.SetSecurityDescriptor($sec, 0)
#Copy App list to install folder (exept on self update)
if ($AppListPath -and ($AppListPath -notlike "$InstallPath*")) {
Write-Output "-> Copying $AppListPath to $InstallPath"
Copy-Item -Path $AppListPath -Destination $InstallPath
}
#Add 1 to counter file
try {
Invoke-RestMethod -Uri "https://github.com/Romanitho/WAU-MSI/releases/download/v$($WAUconfig.ProductVersion)/WAU_InstallCounter" | Out-Null
Write-Host "-> Reported installation."
}
catch {
Write-Host "-> Not able to report installation."
}
Write-Host "### WAU MSI Post actions succeeded! ###"
}
catch {
Write-Host "### WAU Installation failed! Error $_. ###"
return $False
}
}
function Uninstall-WingetAutoUpdate {
Write-Host "### Uninstalling WAU started! ###"
Write-Host "-> Removing scheduled tasks."
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Policies" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
#If upgrade, keep app list. Else, remove.
if ($Upgrade -like "#{*}") {
Write-Output "-> Upgrade detected. Keeping *.txt app lists"
}
else {
$AppLists = Get-Item (Join-Path "$InstallPath" "*_apps.txt")
if ($AppLists) {
Write-Output "-> Removing items: $AppLists"
Remove-Item $AppLists -Force
}
}
$ConfFolder = Get-Item (Join-Path "$InstallPath" "config") -ErrorAction SilentlyContinue
if ($ConfFolder) {
Write-Output "-> Removing item: $ConfFolder"
Remove-Item $ConfFolder -Force -Recurse
}
Write-Host "### Uninstallation done! ###"
Start-sleep 1
}
<# MAIN #>
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$Script:ProgressPreference = 'SilentlyContinue'
# Uninstall
if ($Uninstall) {
Uninstall-WingetAutoUpdate
}
# Install
else {
Install-WingetAutoUpdate
}

View File

@ -3,7 +3,8 @@
Function Get-WAUConfig {
#Get WAU Configurations from install config
$WAUConfig = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -ErrorAction SilentlyContinue
$WAUConfig_64_86 = Get-ItemProperty -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate*", "HKLM:\SOFTWARE\WOW6432Node\Romanitho\Winget-AutoUpdate*" -ErrorAction SilentlyContinue | Sort-Object { $_.ProductVersion } -Descending
$WAUConfig = $WAUConfig_64_86[0]
#Check if GPO Management is enabled
$ActivateGPOManagement = Get-ItemPropertyValue "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -Name "WAU_ActivateGPOManagement" -ErrorAction SilentlyContinue

View File

@ -86,6 +86,64 @@ function Install-Prerequisites {
}
}
#Check if Winget is installed (and up to date)
try {
#Get latest WinGet info
$WinGeturl = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
$WinGetAvailableVersion = ((Invoke-WebRequest $WinGeturl -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace("v", "")
}
catch {
#if fail set version to the latest version as of 2024-04-29
$WinGetAvailableVersion = "1.7.11132"
}
try {
#Get Admin Context Winget Location
$WingetInfo = (Get-Item "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_8wekyb3d8bbwe\winget.exe").VersionInfo | Sort-Object -Property FileVersionRaw
#If multiple versions, pick most recent one
$WingetCmd = $WingetInfo[-1].FileName
#Get current Winget Version
$WingetInstalledVersion = (& $WingetCmd -v).Replace("v", "").trim()
}
catch {
Write-ToLog "WinGet is not installed" "Red"
}
#Check if the current available WinGet is newer than the installed
if ($WinGetAvailableVersion -gt $WinGetInstalledVersion) {
#Install WinGet MSIXBundle in SYSTEM context
try {
#Download WinGet MSIXBundle
Write-ToLog "-> Downloading WinGet MSIXBundle for App Installer..."
$WinGetURL = "https://github.com/microsoft/winget-cli/releases/download/v$WinGetAvailableVersion/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
$WingetInstaller = "$env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
Invoke-RestMethod -Uri $WinGetURL -OutFile $WingetInstaller
#Install
Write-ToLog "-> Installing WinGet MSIXBundle for App Installer..."
Add-AppxProvisionedPackage -Online -PackagePath $WingetInstaller -SkipLicense | Out-Null
Write-ToLog "-> WinGet MSIXBundle (v$WinGetAvailableVersion) for App Installer installed successfully!" "green"
#Reset WinGet Sources
$WingetInfo = (Get-Item "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_8wekyb3d8bbwe\winget.exe").VersionInfo | Sort-Object -Property FileVersionRaw
#If multiple versions, pick most recent one
$WingetCmd = $WingetInfo[-1].FileName
& $WingetCmd source reset --force
Write-ToLog "-> WinGet sources reset.`n" "green"
$return = "success"
}
catch {
Write-ToLog "-> Failed to install WinGet MSIXBundle for App Installer...`n" "red"
#Force Store Apps to update
Update-StoreApps
$return = "fail"
}
#Remove WinGet MSIXBundle
Remove-Item -Path $WingetInstaller -Force -ErrorAction SilentlyContinue
}
else {
Write-ToLog "-> WinGet is up to date: v$WinGetInstalledVersion`n" "Green"
}
Write-ToLog "Prerequisites checked. OK`n" "Green"
}

View File

@ -1,168 +0,0 @@
#Function to make actions after WAU update
function Invoke-PostUpdateActions {
#log
Write-ToLog "Running Post Update actions:" "yellow"
#Update Winget if not up to date
$null = Update-WinGet
#Create WAU Regkey if not present
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
if (!(test-path $regPath)) {
New-Item $regPath -Force
New-ItemProperty $regPath -Name DisplayName -Value "Winget-AutoUpdate (WAU)" -Force
New-ItemProperty $regPath -Name DisplayIcon -Value "C:\Windows\System32\shell32.dll,-16739" -Force
New-ItemProperty $regPath -Name NoModify -Value 1 -Force
New-ItemProperty $regPath -Name NoRepair -Value 1 -Force
New-ItemProperty $regPath -Name Publisher -Value "Romanitho" -Force
New-ItemProperty $regPath -Name URLInfoAbout -Value "https://github.com/Romanitho/Winget-AutoUpdate" -Force
New-ItemProperty $regPath -Name InstallLocation -Value $WorkingDir -Force
New-ItemProperty $regPath -Name UninstallString -Value "powershell.exe -noprofile -executionpolicy bypass -file `"$WorkingDir\WAU-Uninstall.ps1`"" -Force
New-ItemProperty $regPath -Name QuietUninstallString -Value "powershell.exe -noprofile -executionpolicy bypass -file `"$WorkingDir\WAU-Uninstall.ps1`"" -Force
New-ItemProperty $regPath -Name WAU_UpdatePrerelease -Value 0 -PropertyType DWord -Force
#log
Write-ToLog "-> $regPath created." "green"
}
#Fix Notif where WAU_NotificationLevel is not set
$regNotif = Get-ItemProperty $regPath -Name WAU_NotificationLevel -ErrorAction SilentlyContinue
if (!$regNotif) {
New-ItemProperty $regPath -Name WAU_NotificationLevel -Value Full -Force
#log
Write-ToLog "-> Notification level setting was missing. Fixed with 'Full' option."
}
#Set WAU_MaxLogFiles/WAU_MaxLogSize if not set
$MaxLogFiles = Get-ItemProperty $regPath -Name WAU_MaxLogFiles -ErrorAction SilentlyContinue
if (!$MaxLogFiles) {
New-ItemProperty $regPath -Name WAU_MaxLogFiles -Value 3 -PropertyType DWord -Force | Out-Null
New-ItemProperty $regPath -Name WAU_MaxLogSize -Value 1048576 -PropertyType DWord -Force | Out-Null
#log
Write-ToLog "-> MaxLogFiles/MaxLogSize setting was missing. Fixed with 3/1048576 (in bytes, default is 1048576 = 1 MB)."
}
#Security check
Write-ToLog "-> Checking Mods Directory:" "yellow"
$Protected = Invoke-DirProtect "$($WAUConfig.InstallLocation)\mods"
if ($Protected -eq $True) {
Write-ToLog "-> The mods directory is secured!" "green"
}
else {
Write-ToLog "-> Error: The mods directory couldn't be verified as secured!" "red"
}
Write-ToLog "-> Checking Functions Directory:" "yellow"
$Protected = Invoke-DirProtect "$($WAUConfig.InstallLocation)\Functions"
if ($Protected -eq $True) {
Write-ToLog "-> The Functions directory is secured!" "green"
}
else {
Write-ToLog "-> Error: The Functions directory couldn't be verified as secured!" "red"
}
#Convert about.xml if exists (old WAU versions) to reg
$WAUAboutPath = "$WorkingDir\config\about.xml"
if (test-path $WAUAboutPath) {
[xml]$About = Get-Content $WAUAboutPath -Encoding UTF8 -ErrorAction SilentlyContinue
New-ItemProperty $regPath -Name DisplayVersion -Value $About.app.version -Force
#Remove file once converted
Remove-Item $WAUAboutPath -Force -Confirm:$false
#log
Write-ToLog "-> $WAUAboutPath converted." "green"
}
#Convert config.xml if exists (previous WAU versions) to reg
$WAUConfigPath = "$WorkingDir\config\config.xml"
if (test-path $WAUConfigPath) {
[xml]$Config = Get-Content $WAUConfigPath -Encoding UTF8 -ErrorAction SilentlyContinue
if ($Config.app.WAUautoupdate -eq "False") { New-ItemProperty $regPath -Name WAU_DisableAutoUpdate -Value 1 -Force }
if ($Config.app.NotificationLevel) { New-ItemProperty $regPath -Name WAU_NotificationLevel -Value $Config.app.NotificationLevel -Force }
if ($Config.app.UseWAUWhiteList -eq "True") { New-ItemProperty $regPath -Name WAU_UseWhiteList -Value 1 -PropertyType DWord -Force }
if ($Config.app.WAUprerelease -eq "True") { New-ItemProperty $regPath -Name WAU_UpdatePrerelease -Value 1 -PropertyType DWord -Force }
#Remove file once converted
Remove-Item $WAUConfigPath -Force -Confirm:$false
#log
Write-ToLog "-> $WAUConfigPath converted." "green"
}
#Remove old functions / files
$FileNames = @(
"$WorkingDir\functions\Start-Init.ps1",
"$WorkingDir\functions\Get-Policies.ps1",
"$WorkingDir\functions\Get-WAUCurrentVersion.ps1",
"$WorkingDir\functions\Get-WAUUpdateStatus.ps1",
"$WorkingDir\functions\Write-Log.ps1",
"$WorkingDir\functions\Get-WinGetAvailableVersion.ps1",
"$WorkingDir\functions\Invoke-ModsProtect.ps1",
"$WorkingDir\functions\Write-CMTraceLog.ps1",
"$WorkingDir\Version.txt",
"$WorkingDir\winget_system_apps.txt"
)
foreach ($FileName in $FileNames) {
if (Test-Path $FileName) {
Remove-Item $FileName -Force -Confirm:$false
#log
Write-ToLog "-> $FileName removed." "green"
}
}
#Remove old registry key
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -Name "VersionMajor" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -Name "VersionMinor" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -Name "VersionMajor" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -Name "VersionMinor" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -Name "DisplayVersion" -ErrorAction SilentlyContinue
#Activate WAU in user context if previously configured (as "Winget-AutoUpdate-UserContext" at root)
$UserContextTask = Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -TaskPath '\' -ErrorAction SilentlyContinue
if ($UserContextTask) {
#Remove Winget-AutoUpdate-UserContext at root.
$null = $UserContextTask | Unregister-ScheduledTask -Confirm:$False
#Set it in registry as activated.
New-ItemProperty $regPath -Name WAU_UserContext -Value 1 -PropertyType DWord -Force | Out-Null
Write-ToLog "-> Old User Context task deleted and set to 'enabled' in registry."
}
#Set GPO scheduled task if not existing
$GPOTask = Get-ScheduledTask -TaskName 'Winget-AutoUpdate-Policies' -ErrorAction SilentlyContinue
if (!$GPOTask) {
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($WorkingDir)\WAU-Policies.ps1`""
$tasktrigger = New-ScheduledTaskTrigger -Daily -At 6am
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId S-1-5-18 -RunLevel Highest
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 00:05:00
# Set up the task, and register it
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings -Trigger $taskTrigger
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-Policies' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
Write-ToLog "-> Policies task created."
}
### End of post update actions ###
#Reset WAU_UpdatePostActions Value
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -Name "WAU_PostUpdateActions" -Value 0 -Force | Out-Null
#Get updated WAU Config
$Script:WAUConfig = Get-WAUConfig
#Add 1 to counter file
try {
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUConfig.DisplayVersion)/WAU_InstallCounter" | Out-Null
}
catch {
Write-ToLog "-> Not able to report installation." "Yellow"
}
#log
Write-ToLog "Post Update actions finished" "green"
}

View File

@ -1,5 +1,3 @@
#Function to update WAU
function Update-WAU {
$OnClickAction = "https://github.com/Romanitho/Winget-AutoUpdate/releases"
@ -12,91 +10,13 @@ function Update-WAU {
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Button1Action $OnClickAction -Button1Text $Button1Text
#Run WAU update
try {
#Try WAU.zip (v1)
#Force to create a zip file
$ZipFile = "$WorkingDir\WAU_update.zip"
New-Item $ZipFile -ItemType File -Force | Out-Null
#Download the zip
Write-ToLog "Downloading the GitHub Repository Zip version $WAUAvailableVersion" "Cyan"
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUAvailableVersion)/WAU.zip" -OutFile $ZipFile
#Extract Zip File
Write-ToLog "Unzipping the WAU Update package" "Cyan"
$location = "$WorkingDir\WAU_update"
Expand-Archive -Path $ZipFile -DestinationPath $location -Force
Get-ChildItem -Path $location -Recurse | Unblock-File
#Update scritps
Write-ToLog "Updating WAU..." "Yellow"
$TempPath = (Resolve-Path "$location\Winget-AutoUpdate\")[0].Path
$ServiceUI = Test-Path "$WorkingDir\ServiceUI.exe"
if ($TempPath -and $ServiceUI) {
#Do not copy ServiceUI if already existing, causing error if in use.
Copy-Item -Path "$TempPath\*" -Destination "$WorkingDir\" -Exclude ("icons", "ServiceUI.exe") -Recurse -Force
}
elseif ($TempPath) {
Copy-Item -Path "$TempPath\*" -Destination "$WorkingDir\" -Exclude "icons" -Recurse -Force
}
#Remove update zip file and update temp folder
Write-ToLog "Done. Cleaning temp files..." "Cyan"
Remove-Item -Path $ZipFile -Force -ErrorAction SilentlyContinue
Remove-Item -Path $location -Recurse -Force -ErrorAction SilentlyContinue
#Set new version to registry
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -Name "DisplayVersion" -Value $WAUAvailableVersion -Force | Out-Null
#Set Post Update actions to 1
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -Name "WAU_PostUpdateActions" -Value 1 -Force | Out-Null
#Send success Notif
Write-ToLog "WAU Update completed." "Green"
$Title = $NotifLocale.local.outputs.output[3].title -f "Winget-AutoUpdate"
$Message = $NotifLocale.local.outputs.output[3].message -f $WAUAvailableVersion
$MessageType = "success"
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Button1Action $OnClickAction -Button1Text $Button1Text
#Rerun with newer version
Write-ToLog "Re-run WAU"
Start-Process powershell -ArgumentList "-NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command `"$WorkingDir\winget-upgrade.ps1`""
exit
}
catch {
#Try WAU.msi (v2)
try {
#Download the msi
Write-ToLog "Downloading the GitHub Repository MSI version $WAUAvailableVersion" "Cyan"
Write-ToLog "Downloading the GitHub Repository version $WAUAvailableVersion" "Cyan"
$MsiFile = "$env:temp\WAU.msi"
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUAvailableVersion)/WAU.msi" -OutFile $MsiFile
#Migrate registry to save current WAU settings
Write-ToLog "Saving current config before updating with MSI"
$sourcePath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
$destinationPath = "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate"
#Create the destination key if it doesn't exist
if (-not (Test-Path -Path $destinationPath)) {
New-Item -Path $destinationPath -ItemType Directory -Force
Write-ToLog "New registry key created."
}
#Retrieve the properties of the source key
$properties = Get-ItemProperty -Path $sourcePath
foreach ($property in $properties.PSObject.Properties) {
#Check if the value name starts with "WAU_"
if ($property.Name -like "WAU_*") {
#Copy the value to the destination key
Set-ItemProperty -Path $destinationPath -Name $property.Name -Value $property.Value
Write-ToLog "$($property.Name) saved."
}
}
#Update WAU and run
#Update WAU
Write-ToLog "Updating WAU..." "Yellow"
Start-Process msiexec.exe -ArgumentList "/i $MsiFile /qn /L*v ""$WorkingDir\logs\WAU-Installer.log"" RUN_WAU=YES" -Wait
@ -107,7 +27,7 @@ function Update-WAU {
$MessageType = "success"
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Button1Action $OnClickAction -Button1Text $Button1Text
Exit 0
exit 0
}
catch {
@ -120,6 +40,5 @@ function Update-WAU {
Write-ToLog "WAU Update failed" "Red"
}
}
}

View File

@ -1,73 +0,0 @@
#Function to download and update WinGet
Function Update-WinGet {
Write-ToLog "Checking if WinGet is installed/up to date." "Yellow"
#Get latest WinGet info
$WinGeturl = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
try {
#Return latest version
$WinGetAvailableVersion = ((Invoke-WebRequest $WinGeturl -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace("v", "")
}
catch {
#if fail set version to the latest version as of 2024-04-29
$WinGetAvailableVersion = "1.7.11132"
}
try {
#Get Admin Context Winget Location
$WingetInfo = (Get-Item "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_8wekyb3d8bbwe\winget.exe").VersionInfo | Sort-Object -Property FileVersionRaw
#If multiple versions, pick most recent one
$WingetCmd = $WingetInfo[-1].FileName
#Get current Winget Version
$WingetInstalledVersion = [regex]::match((& $WingetCmd -v), '((\d+\.)(\d+\.)(\d+))').Groups[1].Value
}
catch {
Write-ToLog "-> WinGet is not installed" "Red"
}
#Check if the current available WinGet is newer than the installed
if ($WinGetAvailableVersion -gt $WinGetInstalledVersion) {
#Install WinGet MSIXBundle in SYSTEM context
try {
#Download WinGet MSIXBundle
Write-ToLog "-> Downloading WinGet MSIXBundle for App Installer..."
$WinGetURL = "https://github.com/microsoft/winget-cli/releases/download/v$WinGetAvailableVersion/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
$WingetInstaller = "$env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
Invoke-RestMethod -Uri $WinGetURL -OutFile $WingetInstaller
#Install
Write-ToLog "-> Installing WinGet MSIXBundle for App Installer..."
Add-AppxProvisionedPackage -Online -PackagePath $WingetInstaller -SkipLicense | Out-Null
Write-ToLog "-> WinGet MSIXBundle (v$WinGetAvailableVersion) for App Installer installed successfully!" "green"
#Reset WinGet Sources
$WingetInfo = (Get-Item "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_8wekyb3d8bbwe\winget.exe").VersionInfo | Sort-Object -Property FileVersionRaw
#If multiple versions, pick most recent one
$WingetCmd = $WingetInfo[-1].FileName
& $WingetCmd source reset --force
Write-ToLog "-> WinGet sources reset.`n" "green"
$return = "success"
}
catch {
Write-ToLog "-> Failed to install WinGet MSIXBundle for App Installer...`n" "red"
#Force Store Apps to update
Update-StoreApps
$return = "fail"
}
#Remove WinGet MSIXBundle
Remove-Item -Path $WingetInstaller -Force -ErrorAction SilentlyContinue
#Return status
return $return
}
else {
Write-ToLog "-> WinGet is up to date: v$WinGetInstalledVersion`n" "Green"
return "current"
}
}

369
Sources/Wix/build.wxs Normal file
View File

@ -0,0 +1,369 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<!-- Product Config -->
<Package Language="1033" Name="Winget-AutoUpdate" Version="$(var.Version)" Manufacturer="Romanitho" UpgradeCode="BDDEA607-F4AF-4229-8610-16E3B6455FDC" InstallerVersion="200">
<!-- Package Config -->
<SummaryInformation Description="WAU (x64) [$(var.Version)]" />
<Icon Id="icon.ico" SourceFile=".\files\icon.ico" />
<WixVariable Id="WixUIBannerBmp" Value=".\files\banner.bmp"></WixVariable>
<WixVariable Id="WixUIDialogBmp" Value=".\files\dialog.bmp"></WixVariable>
<MediaTemplate EmbedCab="yes" />
<!-- Upgrade handling -->
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- MSI Properties Config -->
<Property Id="ARPCOMMENTS" Value="$(var.Comment)" />
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Run WAU after closing this wizard." />
<Property Id="ARPHELPLINK" Value="https://github.com/Romanitho/Winget-AutoUpdate" />
<Property Id="ARPURLINFOABOUT" Value="https://github.com/Romanitho/Winget-AutoUpdate" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<!-- Check for Powershell -->
<Property Id="POWERSHELLEXE">
<RegistrySearch Id="POWERSHELLEXE" Type="raw" Root="HKLM" Key="SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" Name="Path" />
</Property>
<Launch Condition="Installed OR POWERSHELLEXE" Message="You must have PowerShell 5.0 or higher." />
<!-- WAU Properties Config -->
<Property Id="RUN_WAU" Value="NO" />
<Property Id="NOTIFICATIONLEVEL" Secure="yes" />
<Property Id="NOTIFICATIONLEVEL_VALUE" Value="Full">
<RegistrySearch Id="SearchNotificationLevel" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_NotificationLevel" />
</Property>
<Property Id="USERCONTEXT" Secure="yes" />
<Property Id="USERCONTEXT_REG" Value="#0">
<RegistrySearch Id="SearchUserContext" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_UserContext" />
</Property>
<Property Id="DISABLEWAUAUTOUPDATE" Secure="yes" />
<Property Id="DISABLEWAUAUTOUPDATE_REG" Value="#0">
<RegistrySearch Id="SearchWAUSelfUpdate" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_DisableAutoUpdate" />
</Property>
<Property Id="UPDATESINTERVAL" Secure="yes" />
<Property Id="UPDATESINTERVAL_VALUE" Value="Never">
<RegistrySearch Id="SearchUpdateInterval" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_UpdatesInterval" />
</Property>
<Property Id="UPDATESATLOGON" Secure="yes" />
<Property Id="UPDATESATLOGON_REG" Value="#1">
<RegistrySearch Id="SearchWAUUpdatesAtLogon" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_UpdatesAtLogon" />
</Property>
<Property Id="USEWHITELIST" Value="0">
<RegistrySearch Id="SearchUseWhiteList" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_UseWhiteList" />
</Property>
<Property Id="BLACKLIST_PATH">
<DirectorySearch Id="CheckBlacklistDir" Path="[CURRENTDIRECTORY]">
<FileSearch Id="CheckBlacklistFile" Name="excluded_apps.txt" />
</DirectorySearch>
</Property>
<Property Id="WHITELIST_PATH">
<DirectorySearch Id="CheckWhitelistDir" Path="[CURRENTDIRECTORY]">
<FileSearch Id="CheckWhitelistFile" Name="included_apps.txt" />
</DirectorySearch>
</Property>
<Property Id="B_W_LIST_PATH" Secure="yes" />
<Property Id="LISTPATH" Secure="yes" />
<Property Id="LISTPATH_VALUE">
<RegistrySearch Id="SearchListPath" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_ListPath" />
</Property>
<Property Id="MODSPATH" Secure="yes" />
<Property Id="MODSPATH_VALUE">
<RegistrySearch Id="SearchModsPath" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_ModsPath" />
</Property>
<Property Id="AZUREBLOBURL" Secure="yes" />
<Property Id="AZUREBLOBURL_VALUE">
<RegistrySearch Id="SearchAzureBlobSASURL" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_AzureBlobSASURL" />
</Property>
<Property Id="DONOTRUNONMETERED" Secure="yes" />
<Property Id="DONOTRUNONMETERED_VALUE" Value="#1">
<RegistrySearch Id="SearchDoNotRunOnMetered" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_DoNotRunOnMetered" />
</Property>
<Property Id="UPDATESATTIME" Secure="yes" />
<Property Id="UPDATESATTIME_VALUE" Value="06am">
<RegistrySearch Id="SearchUpdatesAtTime" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_UpdatesAtTime" />
</Property>
<Property Id="BYPASSLISTFORUSERS" Secure="yes" />
<Property Id="BYPASSLISTFORUSERS_VALUE" Value="#0">
<RegistrySearch Id="SearchBypassListForUsers" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_BypassListForUsers" />
</Property>
<Property Id="MAXLOGFILES" Secure="yes" />
<Property Id="MAXLOGFILES_VALUE" Value="#3">
<RegistrySearch Id="SearchMaxLogFiles" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_MaxLogFiles" />
</Property>
<Property Id="MAXLOGSIZE" Secure="yes" />
<Property Id="MAXLOGSIZE_VALUE" Value="#1048576">
<RegistrySearch Id="SearchMaxLogSize" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_MaxLogSize" />
</Property>
<Property Id="UPDATEPRERELEASE" Secure="yes" />
<Property Id="UPDATEPRERELEASE_VALUE" Value="#$(var.PreRelease)">
<RegistrySearch Id="SearchUpdatePrerelease" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_UpdatePrerelease" />
</Property>
<Property Id="DESKTOPSHORTCUT" Secure="yes" />
<Property Id="DESKTOPSHORTCUT_VALUE" Value="#0">
<RegistrySearch Id="SearchDesktopShortcut" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_DesktopShortcut" />
</Property>
<Property Id="STARTMENUSHORTCUT" Secure="yes" />
<Property Id="STARTMENUSHORTCUT_VALUE" Value="#0">
<RegistrySearch Id="SearchStartMenuShortcut" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_StartMenuShortcut" />
</Property>
<!-- UI Config -->
<UI Id="WixUI_InstallDir">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(sys.BUILDARCHSHORT)" Order="3" />
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="StartWAU" Order="1" Condition="WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed" />
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="WAUInstallDirDlg" />
<Publish Dialog="WAUInstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" />
<Publish Dialog="WAUInstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
<Publish Dialog="WAUInstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(sys.BUILDARCHSHORT)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
<Publish Dialog="WAUInstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
<Publish Dialog="WAUInstallDirDlg" Control="Next" Event="NewDialog" Value="WAUConfig" Order="4" Condition="WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
<Publish Dialog="WAUInstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1" />
<Publish Dialog="WAUInstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2" />
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WAUConfig" Order="1" Condition="NOT Installed" />
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" Condition="Installed" />
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg" />
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="WAUConfig" />
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg" />
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg" />
<Publish Dialog="WAUConfig" Control="Back" Event="NewDialog" Value="WAUInstallDirDlg" Order="1" Condition="NOT Installed" />
<Publish Dialog="WAUConfig" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2" Condition="Installed" />
<Publish Dialog="WAUConfig" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" />
<Property Id="ARPNOMODIFY" Value="1" />
<!-- WAU Custome UI Config -->
<Dialog Id="WAUInstallDirDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg" />
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallDirDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallDirDlgTitle)" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="FolderLabel" Type="Text" X="20" Y="60" Width="290" Height="30" NoPrefix="yes" Text="!(loc.InstallDirDlgFolderLabel)" />
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
<Control Id="WAUDesktopShortcut" Type="CheckBox" Width="155" Height="17" X="20" Y="180" Text="Install Desktop shortcut" Property="DESKTOPSHORTCUT_CHECKED" CheckBoxValue="1">
<Publish Property="DESKTOPSHORTCUT" Value="1" Order="1" Condition="DESKTOPSHORTCUT_CHECKED" />
<Publish Property="DESKTOPSHORTCUT" Value="0" Order="2" Condition="NOT DESKTOPSHORTCUT_CHECKED" />
</Control>
<Control Id="WAUStartMenuShortcut" Type="CheckBox" Width="155" Height="17" X="20" Y="200" Text="Install Start Menu shortcut" Property="STARTMENUSHORTCUT_CHECKED" CheckBoxValue="1">
<Publish Property="STARTMENUSHORTCUT" Value="1" Order="1" Condition="STARTMENUSHORTCUT_CHECKED" />
<Publish Property="STARTMENUSHORTCUT" Value="0" Order="2" Condition="NOT STARTMENUSHORTCUT_CHECKED" />
</Control>
</Dialog>
<Dialog Id="WAUConfig" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg" />
</Control>
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}WAU Configuration" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Select the configuration and click on Next" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="NotifLevelLabel" Type="Text" X="20" Y="60" Width="76" Height="14" NoPrefix="yes" Text="Notification level:" />
<Control Id="NotifLevelComboBox" Type="ComboBox" X="98" Y="58" Width="70" Height="16" Property="NOTIFICATIONLEVEL_VALUE" ComboList="yes" Sorted="yes">
<ComboBox Property="NOTIFICATIONLEVEL_VALUE">
<ListItem Value="Full" Text="Full" />
<ListItem Value="SuccessOnly" Text="Succes only" />
<ListItem Value="None" Text="None" />
</ComboBox>
</Control>
<Control Type="CheckBox" Id="UserContextCheckBox" Width="190" Height="14" X="20" Y="80" Text="Install WAU with User context execution too" Property="USERCONTEXT_CHECKED" CheckBoxValue="1">
<Publish Property="USERCONTEXT" Value="1" Order="1" Condition="USERCONTEXT_CHECKED" />
<Publish Property="USERCONTEXT" Value="0" Order="2" Condition="NOT USERCONTEXT_CHECKED" />
</Control>
<Control Type="CheckBox" Id="WAUAutoUpdateCheckBox" Width="190" Height="14" X="20" Y="100" Text="Disable WAU Auto Update" Property="DISABLEWAUAUTOUPDATE_CHECKED" CheckBoxValue="1">
<Publish Property="DISABLEWAUAUTOUPDATE" Value="1" Order="1" Condition="DISABLEWAUAUTOUPDATE_CHECKED" />
<Publish Property="DISABLEWAUAUTOUPDATE" Value="0" Order="2" Condition="NOT DISABLEWAUAUTOUPDATE_CHECKED" />
</Control>
<Control Type="GroupBox" Id="RadioGroupText" Width="320" Height="58" X="20" Y="122" Text="Update interval" />
<Control Type="RadioButtonGroup" Id="UpdateIntervalRad" Property="UPDATESINTERVAL_VALUE" Width="300" Height="18" X="30" Y="136">
<RadioButtonGroup Property="UPDATESINTERVAL_VALUE">
<RadioButton Text="Daily" Height="17" Value="Daily" Width="58" X="0" Y="0" />
<RadioButton Text="Weekly" Height="17" Value="Weekly" Width="58" X="60" Y="0" />
<RadioButton Text="Biweekly" Height="17" Value="Biweekly" Width="58" X="120" Y="0" />
<RadioButton Text="Monthly" Height="17" Value="Monthly" Width="58" X="180" Y="0" />
<RadioButton Text="Never" Height="17" Value="Never" Width="58" X="240" Y="0" />
</RadioButtonGroup>
</Control>
<Control Type="CheckBox" Id="WAUUpdatesAtLogonCheckBox" Width="140" Height="14" X="30" Y="158" Text="Run WAU at user logon" Property="UPDATESATLOGON_CHECKED" CheckBoxValue="1">
<Publish Property="UPDATESATLOGON" Value="1" Order="1" Condition="UPDATESATLOGON_CHECKED" />
<Publish Property="UPDATESATLOGON" Value="0" Order="2" Condition="NOT UPDATESATLOGON_CHECKED" />
</Control>
<Control Type="Text" Id="ListTextBox" Width="313" Height="12" X="20" Y="190" Text="Provided list: (The list must be in the same directory as this installer)" />
<Control Type="Edit" Id="ListEdit" Width="320" Height="17" X="20" Y="202" Property="B_W_LIST_PATH" Disabled="yes" />
</Dialog>
</UI>
<UIRef Id="WixUI_Common" />
<!-- Set properties -->
<SetProperty Id="DESKTOPSHORTCUT_CHECKED" After="AppSearch" Value="1" Condition="DESKTOPSHORTCUT_VALUE = &quot;#1&quot;" />
<SetProperty Action="SetDESKTOPSHORTCUT_0" Id="DESKTOPSHORTCUT" After="AppSearch" Value="0" Condition="(NOT DESKTOPSHORTCUT) AND (DESKTOPSHORTCUT_VALUE &lt;&gt; &quot;#1&quot;)" />
<SetProperty Action="SetDESKTOPSHORTCUT_1" Id="DESKTOPSHORTCUT" After="AppSearch" Value="1" Condition="(NOT DESKTOPSHORTCUT) AND (DESKTOPSHORTCUT_VALUE = &quot;#1&quot;)" />
<SetProperty Id="STARTMENUSHORTCUT_CHECKED" After="AppSearch" Value="1" Condition="STARTMENUSHORTCUT_VALUE = &quot;#1&quot;" />
<SetProperty Action="SetSTARTMENUSHORTCUT_0" Id="STARTMENUSHORTCUT" After="AppSearch" Value="0" Condition="(NOT STARTMENUSHORTCUT) AND (STARTMENUSHORTCUT_VALUE &lt;&gt; &quot;#1&quot;)" />
<SetProperty Action="SetSTARTMENUSHORTCUT_1" Id="STARTMENUSHORTCUT" After="AppSearch" Value="1" Condition="(NOT STARTMENUSHORTCUT) AND (STARTMENUSHORTCUT_VALUE = &quot;#1&quot;)" />
<SetProperty Id="NOTIFICATIONLEVEL_VALUE" After="AppSearch" Value="[NOTIFICATIONLEVEL]" Condition="NOTIFICATIONLEVEL" />
<SetProperty Action="SetUSERCONTEXT_0" Id="USERCONTEXT" After="AppSearch" Value="0" Condition="(NOT USERCONTEXT) AND (USERCONTEXT_REG &lt;&gt; &quot;#1&quot;)" />
<SetProperty Action="SetUSERCONTEXT_1" Id="USERCONTEXT" After="AppSearch" Value="1" Condition="(NOT USERCONTEXT) AND (USERCONTEXT_REG = &quot;#1&quot;)" />
<SetProperty Id="USERCONTEXT_CHECKED" After="AppSearch" Value="1" Condition="USERCONTEXT_REG = &quot;#1&quot;" />
<SetProperty Action="SetDISABLEWAUAUTOUPDATE_0" Id="DISABLEWAUAUTOUPDATE" After="AppSearch" Value="0" Condition="(NOT DISABLEWAUAUTOUPDATE) AND (DISABLEWAUAUTOUPDATE_REG &lt;&gt; &quot;#1&quot;)" />
<SetProperty Action="SetDISABLEWAUAUTOUPDATE_1" Id="DISABLEWAUAUTOUPDATE" After="AppSearch" Value="1" Condition="(NOT DISABLEWAUAUTOUPDATE) AND (DISABLEWAUAUTOUPDATE_REG = &quot;#1&quot;)" />
<SetProperty Id="DISABLEWAUAUTOUPDATE_CHECKED" After="AppSearch" Value="1" Condition="DISABLEWAUAUTOUPDATE_REG = &quot;#1&quot;" />
<SetProperty Id="UPDATESINTERVAL_VALUE" After="AppSearch" Value="[UPDATESINTERVAL]" Condition="UPDATESINTERVAL" />
<SetProperty Action="SetUPDATESATLOGON_0" Id="UPDATESATLOGON" After="AppSearch" Value="0" Condition="(NOT UPDATESATLOGON) AND (UPDATESATLOGON_REG &lt;&gt; &quot;#1&quot;)" />
<SetProperty Action="SetUPDATESATLOGON_1" Id="UPDATESATLOGON" After="AppSearch" Value="1" Condition="(NOT UPDATESATLOGON) AND (UPDATESATLOGON_REG = &quot;#1&quot;)" />
<SetProperty Id="UPDATESATLOGON_CHECKED" After="AppSearch" Value="1" Condition="UPDATESATLOGON_REG = &quot;#1&quot;" />
<SetProperty Action="SetLIST_PATHBlackList" Id="B_W_LIST_PATH" After="AppSearch" Value="[BLACKLIST_PATH]" Condition="BLACKLIST_PATH" />
<SetProperty Action="SetLIST_PATHWhiteList" Id="B_W_LIST_PATH" After="SetLIST_PATHBlackList" Value="[WHITELIST_PATH]" Condition="WHITELIST_PATH" />
<SetProperty Action="SetUSEWHITELIST_0" Id="USEWHITELIST" After="SetLIST_PATHWhiteList" Value="0" Condition="BLACKLIST_PATH OR USEWHITELIST = &quot;#0&quot;" />
<SetProperty Action="SetUSEWHITELIST_1" Id="USEWHITELIST" After="SetUSEWHITELIST_0" Value="1" Condition="WHITELIST_PATH OR USEWHITELIST = &quot;#1&quot;" />
<SetProperty Id="LISTPATH_VALUE" After="AppSearch" Value="[LISTPATH]" Condition="LISTPATH" />
<SetProperty Id="MODSPATH_VALUE" After="AppSearch" Value="[MODSPATH]" Condition="MODSPATH" />
<SetProperty Id="AZUREBLOBURL_VALUE" After="AppSearch" Value="[AZUREBLOBURL]" Condition="AZUREBLOBURL" />
<SetProperty Id="DONOTRUNONMETERED_VALUE" After="AppSearch" Value="#[DONOTRUNONMETERED]" Condition="DONOTRUNONMETERED" />
<SetProperty Id="UPDATESATTIME_VALUE" After="AppSearch" Value="[UPDATESATTIME]" Condition="UPDATESATTIME" />
<SetProperty Id="BYPASSLISTFORUSERS_VALUE" After="AppSearch" Value="#[BYPASSLISTFORUSERS]" Condition="BYPASSLISTFORUSERS" />
<SetProperty Id="MAXLOGFILES_VALUE" After="AppSearch" Value="#[MAXLOGFILES]" Condition="MAXLOGFILES" />
<SetProperty Id="MAXLOGSIZE_VALUE" After="AppSearch" Value="#[MAXLOGSIZE]" Condition="MAXLOGSIZE" />
<SetProperty Action="SetUPDATEPRERELEASE_0" Id="UPDATEPRERELEASE" After="AppSearch" Value="0" Condition="(NOT UPDATEPRERELEASE) AND (UPDATEPRERELEASE_VALUE &lt;&gt; &quot;#1&quot;)" />
<SetProperty Action="SetUPDATEPRERELEASE_1" Id="UPDATEPRERELEASE" After="AppSearch" Value="1" Condition="(NOT UPDATEPRERELEASE) AND (UPDATEPRERELEASE_VALUE = &quot;#1&quot;)" />
<SetProperty Id="CA_PowerShell_Install" Before="CA_PowerShell_Install" Sequence="execute" Value="&quot;[%SystemDrive]\Windows\Sysnative\WindowsPowerShell\v1.0\powershell.exe&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]config\WAU-MSI_Actions.ps1&quot; &quot;[B_W_LIST_PATH]&quot; -InstallPath &quot;[INSTALLDIR]\&quot;" />
<SetProperty Id="CA_PowerShell_Uninstall" Before="CA_PowerShell_Uninstall" Sequence="execute" Value="&quot;[%SystemDrive]\Windows\Sysnative\WindowsPowerShell\v1.0\powershell.exe&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]config\WAU-MSI_Actions.ps1&quot; &quot;[B_W_LIST_PATH]&quot; -InstallPath &quot;[INSTALLDIR]\&quot; -Upgrade &quot;#[UPGRADINGPRODUCTCODE]&quot; -Uninstall" />
<!-- Custom Actions -->
<CustomAction Id="StartWAU" Impersonate="yes" ExeCommand="conhost.exe --headless schtasks /run /tn WAU\Winget-AutoUpdate" Directory="INSTALLDIR" Return="ignore" />
<CustomAction Id="CA_PowerShell_Install" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no" BinaryRef="Wix4UtilCA_X86" />
<CustomAction Id="CA_PowerShell_Uninstall" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no" BinaryRef="Wix4UtilCA_X86" />
<InstallExecuteSequence>
<Custom Action="StartWAU" After="InstallFinalize" Condition="RUN_WAU=&quot;YES&quot;" />
<Custom Action="CA_PowerShell_Install" Before="InstallFinalize" Condition="NOT (REMOVE=&quot;ALL&quot;)" />
<Custom Action="CA_PowerShell_Uninstall" Before="RemoveFiles" Condition="REMOVE=&quot;ALL&quot; OR REINSTALL" />
</InstallExecuteSequence>
<!-- WAU Features -->
<Feature Id="WAU" Title="Winget-AutoUpdate" Level="1">
<ComponentGroupRef Id="CompFiles" />
<ComponentRef Id="CompReg" />
<ComponentRef Id="DesktopShortcut" />
<ComponentRef Id="StartMenuShortcut" />
</Feature>
<!-- WAU Structure -->
<ComponentGroup Id="CompFiles" Directory="INSTALLDIR">
<Files Include="..\Winget-AutoUpdate\**"/>
</ComponentGroup>
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="INSTALLDIR" Name="Winget-AutoUpdate">
<Component Id="CompReg" >
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="ProductVersion" Type="string" Value="$(var.NextSemVer)" KeyPath="yes" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="InstallLocation" Type="string" Value="[INSTALLDIR]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_NotificationLevel" Type="string" Value="[NOTIFICATIONLEVEL_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_UserContext" Type="integer" Value="[USERCONTEXT]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_DisableAutoUpdate" Type="integer" Value="[DISABLEWAUAUTOUPDATE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_UpdatesInterval" Type="string" Value="[UPDATESINTERVAL_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_UpdatesAtLogon" Type="integer" Value="[UPDATESATLOGON]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_UseWhiteList" Type="integer" Value="[USEWHITELIST]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_ListPath" Type="string" Value="[LISTPATH_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_ModsPath" Type="string" Value="[MODSPATH_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_AzureBlobSASURL" Type="string" Value="[AZUREBLOBURL_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_DoNotRunOnMetered" Type="string" Value="[DONOTRUNONMETERED_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_UpdatesAtTime" Type="string" Value="[UPDATESATTIME_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_BypassListForUsers" Type="string" Value="[BYPASSLISTFORUSERS_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_MaxLogFiles" Type="string" Value="[MAXLOGFILES_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_MaxLogSize" Type="string" Value="[MAXLOGSIZE_VALUE]" />
</RegistryKey>
<RegistryKey Key="SOFTWARE\[Manufacturer]\[ProductName]" Root="HKLM">
<RegistryValue Name="WAU_UpdatePrerelease" Type="integer" Value="[UPDATEPRERELEASE]" />
</RegistryKey>
<RegistryKey Key="AppUserModelId\Windows.SystemToast.WAU.Notification" Root="HKCR">
<RegistryValue Name="DisplayName" Type="expandable" Value="Application Update" />
</RegistryKey>
<RegistryKey Key="AppUserModelId\Windows.SystemToast.WAU.Notification" Root="HKCR">
<RegistryValue Name="IconUri" Type="expandable" Value="%SystemRoot%\system32\@WindowsUpdateToastIcon.png" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]">
<RegistryValue Name="WAU_DesktopShortcut" Type="integer" Value="[DESKTOPSHORTCUT]" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]">
<RegistryValue Name="WAU_StartMenuShortcut" Type="integer" Value="[STARTMENUSHORTCUT]" />
</RegistryKey>
</Component>
</Directory>
</StandardDirectory>
<StandardDirectory Id="DesktopFolder">
<Component Id="DesktopShortcut" Condition="DESKTOPSHORTCUT = 1">
<RegistryKey Root="HKCU" Key="SOFTWARE\[Manufacturer]\[ProductName]">
<RegistryValue Name="WAU_DesktopShortcut" Type="integer" Value="[DESKTOPSHORTCUT]" KeyPath="yes" />
</RegistryKey>
<Shortcut Id="DesktopShortcut" Name="Run WAU" Target="[System64Folder]conhost.exe" Arguments="--headless powershell.exe -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]User-Run.ps1&quot;" Icon="icon.ico" />
</Component>
</StandardDirectory>
<StandardDirectory Id="ProgramMenuFolder">
<Directory Id="Wau" Name="Winget-AutoUpdate">
<Component Id="StartMenuShortcut" Condition="STARTMENUSHORTCUT = 1">
<RegistryKey Root="HKCU" Key="SOFTWARE\[Manufacturer]\[ProductName]">
<RegistryValue Name="WAU_StartMenuShortcut" Type="integer" Value="[STARTMENUSHORTCUT]" KeyPath="yes" />
</RegistryKey>
<Shortcut Id="StartMenuShortcut1" Name="Run WAU" Target="[System64Folder]conhost.exe" Arguments="--headless powershell.exe -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]User-Run.ps1&quot;" Icon="icon.ico" />
<Shortcut Id="StartMenuShortcut2" Name="Open log" Target="[INSTALLDIR]logs\updates.log" />
<RemoveFolder Id="WAU" On="uninstall" />
</Component>
</Directory>
</StandardDirectory>
</Package>
</Wix>

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

BIN
Sources/Wix/files/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB