commit
aa36b6b7f7
|
@ -30,6 +30,7 @@ From version 1.9.0 (on new installations) WAU runs everyday at 6AM. You can now
|
|||
|
||||
### Log location
|
||||
You can find logs in install location, in logs folder.
|
||||
If **Intune Management Extension** is installed, a **SymLink** (WAU-updates.log) is created under **C:\ProgramData\Microsoft\IntuneManagementExtension\Logs**
|
||||
|
||||
### "Unknown" App version
|
||||
As explained in this [post](https://github.com/microsoft/winget-cli/issues/1255), Winget cannot detect the current version of some installed apps. We decided to skip managing these apps with WAU to avoid retries each time WAU runs:
|
||||
|
@ -96,7 +97,9 @@ Disable Winget-AutoUpdate update checking. By default, WAU auto updates if new v
|
|||
Use White List instead of Black List. This setting will not create the "excluded_apps.txt" but "included_apps.txt".
|
||||
|
||||
**-ListPath**
|
||||
Get Black/White List from external Path (**URL/UNC/GPO/Local**) - download/copy to Winget-AutoUpdate installation location if external list is newer.
|
||||
Get Black/White List from external Path (**URL/UNC/Local/GPO**) - download/copy to Winget-AutoUpdate installation location if external list is newer.
|
||||
**PATH** must end with a Directory, not a File...
|
||||
|
||||
If `-ListPath` is set to **GPO** the Black/White List can be managed from within the GPO itself under **Application GPO Blacklist**/**Application GPO Whitelist**.
|
||||
Thanks to [Weatherlights](https://github.com/Weatherlights) in [#256 (reply in thread)](https://github.com/Romanitho/Winget-AutoUpdate/discussions/256#discussioncomment-4710599)!
|
||||
|
||||
|
|
|
@ -367,18 +367,9 @@ function Install-WingetAutoUpdate {
|
|||
New-ItemProperty $regPath -Name WAU_BypassListForUsers -Value 1 -PropertyType DWord -Force | Out-Null
|
||||
}
|
||||
|
||||
#Set ACL for Authenticated Users on logfile
|
||||
$LogFile = "$WingetUpdatePath\logs\updates.log"
|
||||
if (test-path $LogFile) {
|
||||
$NewAcl = Get-Acl -Path $LogFile
|
||||
$identity = New-Object System.Security.Principal.SecurityIdentifier S-1-5-11
|
||||
$fileSystemRights = "Modify"
|
||||
$type = "Allow"
|
||||
$fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, $type
|
||||
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
|
||||
$NewAcl.SetAccessRule($fileSystemAccessRule)
|
||||
Set-Acl -Path $LogFile -AclObject $NewAcl
|
||||
}
|
||||
#Log file and symlink initialization
|
||||
. "$WingetUpdatePath\functions\Start-Init.ps1"
|
||||
Start-Init
|
||||
|
||||
#Security check
|
||||
Write-host "`nChecking Mods Directory:" -ForegroundColor Yellow
|
||||
|
@ -434,6 +425,9 @@ function Uninstall-WingetAutoUpdate {
|
|||
|
||||
if (!$NoClean) {
|
||||
Remove-Item $InstallLocation -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
|
||||
}
|
||||
}
|
||||
else {
|
||||
#Keep critical files
|
||||
|
|
|
@ -111,11 +111,22 @@ if (Test-Network) {
|
|||
|
||||
#Get External ListPath if run as System
|
||||
if ($WAUConfig.WAU_ListPath) {
|
||||
Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))"
|
||||
if ($($WAUConfig.WAU_ListPath) -ne "GPO") {
|
||||
$NewList = Test-ListPath $WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/") $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation.TrimEnd(" ", "\")
|
||||
$ListPathClean = $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))
|
||||
Write-Log "WAU uses External Lists from: $ListPathClean"
|
||||
if ($ListPathClean -ne "GPO") {
|
||||
$NewList = Test-ListPath $ListPathClean $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation.TrimEnd(" ", "\")
|
||||
if ($ReachNoPath) {
|
||||
Write-Log "Couldn't reach/find/compare/copy from $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))..." "Red"
|
||||
Write-Log "Couldn't reach/find/compare/copy from $ListPathClean..." "Red"
|
||||
if ($ListPathClean -notlike "http*") {
|
||||
if (Test-Path -Path "$ListPathClean" -PathType Leaf) {
|
||||
Write-Log "PATH must end with a Directory, not a File..." "Red"
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($ListPathClean -match "_apps.txt") {
|
||||
Write-Log "PATH must end with a Directory, not a File..." "Red"
|
||||
}
|
||||
}
|
||||
$Script:ReachNoPath = $False
|
||||
}
|
||||
if ($NewList) {
|
||||
|
@ -139,10 +150,11 @@ if (Test-Network) {
|
|||
|
||||
#Get External ModsPath if run as System
|
||||
if ($WAUConfig.WAU_ModsPath) {
|
||||
Write-Log "WAU uses External Mods from: $($WAUConfig.WAU_ModsPath.TrimEnd(" ", "\", "/"))"
|
||||
$NewMods, $DeletedMods = Test-ModsPath $WAUConfig.WAU_ModsPath.TrimEnd(" ", "\", "/") $WAUConfig.InstallLocation.TrimEnd(" ", "\")
|
||||
$ModsPathClean = $($WAUConfig.WAU_ModsPath.TrimEnd(" ", "\", "/"))
|
||||
Write-Log "WAU uses External Mods from: $ModsPathClean"
|
||||
$NewMods, $DeletedMods = Test-ModsPath $ModsPathClean $WAUConfig.InstallLocation.TrimEnd(" ", "\")
|
||||
if ($ReachNoPath) {
|
||||
Write-Log "Couldn't reach/find/compare/copy from $($WAUConfig.WAU_ModsPath.TrimEnd(" ", "\", "/"))..." "Red"
|
||||
Write-Log "Couldn't reach/find/compare/copy from $ModsPathClean..." "Red"
|
||||
$Script:ReachNoPath = $False
|
||||
}
|
||||
if ($NewMods -gt 0) {
|
||||
|
|
|
@ -5,6 +5,12 @@ function Invoke-PostUpdateActions {
|
|||
#log
|
||||
Write-Log "Running Post Update actions:" "yellow"
|
||||
|
||||
#Check if Intune Management Extension Logs folder and WAU-updates.log exists, make symlink
|
||||
if ((Test-Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs") -and !(Test-Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log")) {
|
||||
Write-log "-> Creating SymLink for log file in Intune Management Extension log folder" "yellow"
|
||||
New-Item -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log" -ItemType SymbolicLink -Value $LogFile -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
}
|
||||
|
||||
Write-Log "-> Checking prerequisites..." "yellow"
|
||||
|
||||
#Check if Visual C++ 2019 or 2022 installed
|
||||
|
|
|
@ -5,16 +5,21 @@ function Start-Init {
|
|||
#Config console output encoding
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
|
||||
$caller = Get-ChildItem $MyInvocation.PSCommandPath | Select-Object -Expand Name
|
||||
if ($caller -eq "Winget-Upgrade.ps1") {
|
||||
#Log Header
|
||||
$Log = "`n##################################################`n# CHECK FOR APP UPDATES - $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern)`n##################################################"
|
||||
$Log | Write-host
|
||||
|
||||
#Logs initialisation
|
||||
$Script:LogFile = "$WorkingDir\logs\updates.log"
|
||||
}
|
||||
elseif ($caller -eq "Winget-AutoUpdate-Install.ps1") {
|
||||
$Script:LogFile = "$WingetUpdatePath\logs\updates.log"
|
||||
}
|
||||
|
||||
if (!(Test-Path $LogFile)) {
|
||||
#Create file if doesn't exist
|
||||
New-Item -ItemType File -Path $LogFile -Force
|
||||
New-Item -ItemType File -Path $LogFile -Force | Out-Null
|
||||
|
||||
#Set ACL for users on logfile
|
||||
$NewAcl = Get-Acl -Path $LogFile
|
||||
|
@ -26,8 +31,28 @@ function Start-Init {
|
|||
$NewAcl.SetAccessRule($fileSystemAccessRule)
|
||||
Set-Acl -Path $LogFile -AclObject $NewAcl
|
||||
}
|
||||
elseif ((Test-Path $LogFile) -and ($caller -eq "Winget-AutoUpdate-Install.ps1")) {
|
||||
#Set ACL for users on logfile
|
||||
$NewAcl = Get-Acl -Path $LogFile
|
||||
$identity = New-Object System.Security.Principal.SecurityIdentifier S-1-5-11
|
||||
$fileSystemRights = "Modify"
|
||||
$type = "Allow"
|
||||
$fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, $type
|
||||
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
|
||||
$NewAcl.SetAccessRule($fileSystemAccessRule)
|
||||
Set-Acl -Path $LogFile -AclObject $NewAcl
|
||||
}
|
||||
|
||||
#Check if Intune Management Extension Logs folder and WAU-updates.log exists, make symlink
|
||||
if ((Test-Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs") -and !(Test-Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log")) {
|
||||
Write-host "`nCreating SymLink for log file in Intune Management Extension log folder" -ForegroundColor Yellow
|
||||
New-Item -Path "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs\WAU-updates.log" -ItemType SymbolicLink -Value $LogFile -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
}
|
||||
|
||||
|
||||
if ($caller -eq "Winget-Upgrade.ps1") {
|
||||
#Log file
|
||||
$Log | out-file -filepath $LogFile -Append
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue