Move registry keys to future location
parent
bfa098bfd7
commit
e16c12e456
|
@ -204,7 +204,7 @@ function Start-Installations {
|
|||
#Run Winget-Install script if box is checked
|
||||
if ($AppToInstall) {
|
||||
Start-PopUp "Installing applications..."
|
||||
$WAUInstallPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation
|
||||
$WAUInstallPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate\" -Name InstallLocation
|
||||
|
||||
#Try with admin rights.
|
||||
try {
|
||||
|
@ -275,7 +275,7 @@ function Start-Uninstallations ($AppToUninstall) {
|
|||
}
|
||||
|
||||
function Get-WAUInstallStatus {
|
||||
$WAUVersion = Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\ -ErrorAction SilentlyContinue | Select-Object -ExpandProperty DisplayVersion -ErrorAction SilentlyContinue
|
||||
$WAUVersion = Get-ItemProperty -Path HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate\ -ErrorAction SilentlyContinue | Select-Object -ExpandProperty DisplayVersion -ErrorAction SilentlyContinue
|
||||
if ($WAUVersion -eq $WAUConfiguratorVersion) {
|
||||
$WAULabelText = "WAU is currently installed (v$WAUVersion)."
|
||||
$WAUStatus = "Green"
|
||||
|
@ -577,7 +577,7 @@ function Start-InstallGUI {
|
|||
$UninstallWAUButton.add_click(
|
||||
{
|
||||
#Uninstall WAU from registry command
|
||||
$Arguments = Get-ItemPropertyValue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -Name "UninstallString"
|
||||
$Arguments = Get-ItemPropertyValue "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate" -Name "UninstallString"
|
||||
Start-Process "cmd.exe" -ArgumentList "/c $Arguments" -Wait -Verb RunAs
|
||||
$WAUInstallStatus = Get-WAUInstallStatus
|
||||
$WAUStatusLabel.Text = $WAUInstallStatus[0]
|
||||
|
@ -699,7 +699,7 @@ function Start-InstallGUI {
|
|||
$LogButton.add_click(
|
||||
{
|
||||
try {
|
||||
$LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocatifon
|
||||
$LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate\" -Name InstallLocatifon
|
||||
Start-Process "$LogPath\Logs"
|
||||
}
|
||||
catch {
|
||||
|
|
|
@ -361,7 +361,7 @@ 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
|
||||
$InstallLocation = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate\" -Name InstallLocation -ErrorAction SilentlyContinue
|
||||
|
||||
#Check if installed location exists and delete
|
||||
if ($InstallLocation) {
|
||||
|
@ -383,7 +383,7 @@ function Uninstall-WingetAutoUpdate {
|
|||
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
|
||||
& reg delete "HKLM\SOFTWARE\Romanitho\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
|
||||
|
@ -488,7 +488,7 @@ Write-Host "`t https://github.com/Romanitho/Winget-AutoUpdate`n" -Foreground
|
|||
Write-Host "`t________________________________________________________`n"
|
||||
|
||||
#Define WAU registry key
|
||||
$Script:regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
|
||||
$Script:regPath = "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate"
|
||||
|
||||
if (!$Uninstall) {
|
||||
Write-ToLog " INSTALLING WAU" -LogColor "Cyan" -IsHeader
|
||||
|
|
|
@ -14,7 +14,7 @@ Daily update settings from policies
|
|||
$ActivateGPOManagement = Get-ItemPropertyValue "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -Name "WAU_ActivateGPOManagement" -ErrorAction SilentlyContinue
|
||||
if ($ActivateGPOManagement -eq 1) {
|
||||
#Add (or update) tag to activate WAU-Policies Management
|
||||
New-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -Name WAU_RunGPOManagement -Value 1 -Force | Out-Null
|
||||
New-ItemProperty "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate" -Name WAU_RunGPOManagement -Value 1 -Force | Out-Null
|
||||
}
|
||||
|
||||
#Get WAU settings
|
||||
|
@ -32,7 +32,7 @@ if ($WAUConfig.WAU_RunGPOManagement -eq 1) {
|
|||
Add-Content -Path $GPOLogFile -Value "GPO Management Enabled. Policies updated."
|
||||
}
|
||||
else {
|
||||
New-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -Name WAU_RunGPOManagement -Value 0 -Force | Out-Null
|
||||
New-ItemProperty "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate" -Name WAU_RunGPOManagement -Value 0 -Force | Out-Null
|
||||
$WAUConfig.WAU_RunGPOManagement = 0
|
||||
Add-Content -Path $GPOLogFile -Value "GPO Management Disabled. Policies removed."
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ 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
|
||||
$InstallLocation = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate\" -Name InstallLocation
|
||||
|
||||
#Check if installed location exists and delete
|
||||
if (Test-Path ($InstallLocation)) {
|
||||
|
@ -52,7 +52,7 @@ try {
|
|||
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
|
||||
& reg delete "HKLM\SOFTWARE\Romanitho\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
|
||||
}
|
||||
|
|
|
@ -311,7 +311,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 initialisation
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#Send Notify Script
|
||||
|
||||
#get xml notif config
|
||||
$WAUinstalledPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation
|
||||
$WAUinstalledPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate\" -Name InstallLocation
|
||||
[xml]$NotifConf = Get-Content "$WAUinstalledPath\config\notif.xml" -Encoding UTF8 -ErrorAction SilentlyContinue
|
||||
if (!($NotifConf)) {
|
||||
break
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Function Get-WAUConfig {
|
||||
|
||||
#Get WAU Configurations from install config
|
||||
$WAUConfig = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" -ErrorAction SilentlyContinue
|
||||
$WAUConfig = Get-ItemProperty -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate" -ErrorAction SilentlyContinue
|
||||
|
||||
#Check if GPO Management is enabled
|
||||
$ActivateGPOManagement = Get-ItemPropertyValue "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -Name "WAU_ActivateGPOManagement" -ErrorAction SilentlyContinue
|
||||
|
|
|
@ -9,7 +9,7 @@ function Invoke-PostUpdateActions {
|
|||
$null = Update-WinGet
|
||||
|
||||
#Create WAU Regkey if not present
|
||||
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
|
||||
$regPath = "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate"
|
||||
if (!(test-path $regPath)) {
|
||||
New-Item $regPath -Force
|
||||
New-ItemProperty $regPath -Name DisplayName -Value "Winget-AutoUpdate (WAU)" -Force
|
||||
|
@ -113,8 +113,8 @@ function Invoke-PostUpdateActions {
|
|||
}
|
||||
|
||||
#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\Romanitho\Winget-AutoUpdate" -Name "VersionMajor" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Romanitho\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
|
||||
|
@ -143,11 +143,24 @@ function Invoke-PostUpdateActions {
|
|||
Write-ToLog "-> Policies task created."
|
||||
}
|
||||
|
||||
#Migrate registry to new location (MSI Prerequisites)
|
||||
$sourcePath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
|
||||
$destinationPath = "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate"
|
||||
if (-not (Test-Path (Split-Path $destinationPath))) {
|
||||
New-Item -Path (Split-Path $destinationPath) -ItemType Directory
|
||||
}
|
||||
try {
|
||||
Move-Item -Path $sourcePath -Destination $destinationPath -Force
|
||||
Write-ToLog "-> Migrated registry from $sourcePath to $destinationPath."
|
||||
}
|
||||
catch {
|
||||
Write-ToLog "-> Failed tro migrate registry to new location"
|
||||
}
|
||||
|
||||
### 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
|
||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate" -Name "WAU_PostUpdateActions" -Value 0 -Force | Out-Null
|
||||
|
||||
#Get updated WAU Config
|
||||
$Script:WAUConfig = Get-WAUConfig
|
||||
|
|
|
@ -46,10 +46,10 @@ function Update-WAU {
|
|||
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
|
||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Romanitho\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
|
||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate" -Name "WAU_PostUpdateActions" -Value 1 -Force | Out-Null
|
||||
|
||||
#Send success Notif
|
||||
Write-ToLog "WAU Update completed." "Green"
|
||||
|
|
|
@ -35,7 +35,7 @@ $AllVersions = $False
|
|||
$Lnk = @("")
|
||||
|
||||
#Registry _value_ (DWord/String) to add in existing registry Key (Key created if not existing). Example:
|
||||
#$AddKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
|
||||
#$AddKey = "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate"
|
||||
#$AddValue = "WAU_BypassListForUsers"
|
||||
#$AddTypeData = "1"
|
||||
#$AddType = "DWord"
|
||||
|
@ -46,7 +46,7 @@ $AddType = ""
|
|||
|
||||
#Registry _value_ to delete in existing registry Key.
|
||||
#Value can be omitted for deleting entire Key!. Example:
|
||||
#$DelKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
|
||||
#$DelKey = "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate"
|
||||
#$DelValue = "WAU_BypassListForUsers"
|
||||
$DelKey = ""
|
||||
$DelValue = ""
|
||||
|
|
Loading…
Reference in New Issue