Romanitho / Winget-AutoUpdate

WAU daily updates apps as system and notify connected users. (Allowlist and Blocklist support)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: System update when user has the programme open

jNizM opened this issue · comments

commented

The problem

Im not sure if this is a WAU or winget issue

If Notepad++ is installed as admin (--scope machine) under "C:\Program Files\Notepad++" and the user has Notepad++ open, WAU tried to update automatically in the system context.
According to the WAU log, winget and "programs and features" it was installed. However, the old version is still in the directory.

Programs and Features shows the new version
image

Install Path shows "notepad++.exe" as old version and "uninstall.exe" as new version
image

Also "About Notepad++" shows old version
image

What version of WAU has the issue?

1.17.7

What version of Windows are you using (ex. Windows 11 22H2)?

Windows 11 22H2

What version of winget are you using?

1.5.2201

Log information

##################################################
#     CHECK FOR APP UPDATES - 11.09.2023
##################################################
07:33:31 - Running in System context
07:33:31 - Activated WAU GPO Management detected, comparing...
07:33:31 - Changed settings detected and applied
07:33:31 - Notification Level: Full. Notification Language: Deutsch
07:33:31 - Checking internet connection...
07:33:31 - Connected !
07:33:33 - Winget Version: v1.5.2201
07:33:33 - WAU current version: 1.17.7
07:33:33 - WAU AutoUpdate is Enabled.
07:33:33 - WAU is up to date.
07:33:33 - WAU uses External Lists from: GPO
07:33:33 - WAU uses White List config
07:33:33 - Checking application updates on Winget Repository...
-> Available update : Microsoft Edge. Current version : 116.0.1938.69. Available version : 116.0.1938.76.
-> Available update : Microsoft 365 Apps for Enterprise - de-de. Current version : 16.0.16529.20226. Available version : 16.0.16626.20148.
-> Available update : Notepad++ (64-bit x64). Current version : 8.5.6. Available version : 8.5.7.
07:33:35 - Microsoft Edge : Skipped upgrade because it is not in the included app list
07:33:35 - Microsoft 365 Apps for Enterprise - de-de : Skipped upgrade because it is not in the included app list
07:33:35 - Updating Notepad++ (64-bit x64) from 8.5.6 to 8.5.7...
07:33:40 - ##########   WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID 'Notepad++.Notepad++'   ##########
07:33:40 - -> Running: Winget upgrade --id Notepad++.Notepad++ --accept-package-agreements --accept-source-agreements -h

   - 
                                                                                                                        

  █▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  1024 KB / 16.9 MB
  ███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  2.00 MB / 16.9 MB
  █████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  3.00 MB / 16.9 MB
  ███████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  4.00 MB / 16.9 MB
  ████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  5.00 MB / 16.9 MB
  ██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  6.00 MB / 16.9 MB
  ████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  7.00 MB / 16.9 MB
  ██████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  8.00 MB / 16.9 MB
  ███████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  9.00 MB / 16.9 MB
  █████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒  10.0 MB / 16.9 MB
  ███████████████████▒▒▒▒▒▒▒▒▒▒▒  11.0 MB / 16.9 MB
  █████████████████████▒▒▒▒▒▒▒▒▒  12.0 MB / 16.9 MB
  ███████████████████████▒▒▒▒▒▒▒  13.0 MB / 16.9 MB
  ████████████████████████▒▒▒▒▒▒  14.0 MB / 16.9 MB
  ██████████████████████████▒▒▒▒  15.0 MB / 16.9 MB
  ████████████████████████████▒▒  16.0 MB / 16.9 MB
  ██████████████████████████████  16.9 MB / 16.9 MB
                                                                                                                        
The `msstore` source requires that you view the following agreements before using.
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
The source requires the current machine's 2-letter geographic region to be sent to the backend service to function properly (ex. "US").

Found Notepad++ [Notepad++.Notepad++] Version 8.5.7
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.5.7/npp.8.5.7.Installer.x64.exe

   - 
   \ 
   | 
   / 
                                                                                                                        

                                                                                                                        

  ██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  1.51 MB / 4.51 MB
  ██████████████████████████████  4.51 MB / 4.51 MB
Successfully verified installer hash
Starting package install...

   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
                                                                                                                        
Successfully installed
07:33:48 - ##########   WINGET UPGRADE PROCESS FINISHED FOR APPLICATION ID 'Notepad++.Notepad++'   ##########
07:33:48 - Notepad++ (64-bit x64) updated to 8.5.7 !
07:33:51 - 1 apps updated ! No more update.
07:33:52 - User logged on, get a list of installed Winget apps in System context...
07:33:54 - Starting WAU in User context

Additional information

No response

commented

Also can these be removed in log?

   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
   / 

Im not sure if this is a WAU or winget issue

This is neither a fault/issue of WAU nor winget, but the application itself.
Notepad++.exe is locked when open and its own installation method doesn't care about that.
For example UltraEdit loads the executable entirely into memory so it can be upgraded even if open.

You could craft your own Notepad++.Notepad++-preinstall.ps1 from mods\_AppID-template.ps1 that forcefully closes the process...

#Beginning of Process Name to Stop - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
$Proc = @("notepad++")

@Romanitho is working? on a branch https://github.com/Romanitho/Winget-AutoUpdate/tree/user-approval to make it ask before upgrading

commented

I have now rolled out a mod script for Notepad++.
Thanks for the hint

NB.
The mods feature is an by WAU unsupported feature when it comes to the example scripts/functions and as such: only examples.

commented

And you can also share or pick examples here:
https://github.com/Romanitho/Winget-AutoUpdate/discussions/categories/mods

regarding the

   \ 
   | 
   / 
   - 
   \ 
   | 
   / 
   - 
   \ 
   | 
...

this is due to the call of winget.exe and this is what the process returns. This is not propre WAU logs. So we need to apply post actions in the log, but not a priority for us I guess 😇
This is why we have a section in the log that cuts the parts:

##########   WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID 'AppID'   ##########
...
##########   WINGET UPGRADE PROCESS FINISHED FOR APPLICATION ID 'AppID'   ##########