Merge pull request #293 from KnifMelti/Requests

Feature Requests
pull/294/head
Romain 2023-03-06 15:19:24 +01:00 committed by GitHub
commit aa36b6b7f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 70 additions and 30 deletions

View File

@ -29,7 +29,8 @@ By default, scripts and components will be placed in ProgramData location (insid
From version 1.9.0 (on new installations) WAU runs everyday at 6AM. You can now configure the frequency with `-UpdatesInterval` option (Daily, BiDaily, Weekly, BiWeekly or Monthly). You can also add `-UpdatesAtLogon` parameter to run at user logon and keep this option activated like previous versions (recommanded). From version 1.9.0 (on new installations) WAU runs everyday at 6AM. You can now configure the frequency with `-UpdatesInterval` option (Daily, BiDaily, Weekly, BiWeekly or Monthly). You can also add `-UpdatesAtLogon` parameter to run at user logon and keep this option activated like previous versions (recommanded).
### Log location ### Log location
You can find logs in install location, in logs folder. 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 ### "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: 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". Use White List instead of Black List. This setting will not create the "excluded_apps.txt" but "included_apps.txt".
**-ListPath** **-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**. 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)! Thanks to [Weatherlights](https://github.com/Weatherlights) in [#256 (reply in thread)](https://github.com/Romanitho/Winget-AutoUpdate/discussions/256#discussioncomment-4710599)!

View File

@ -367,18 +367,9 @@ function Install-WingetAutoUpdate {
New-ItemProperty $regPath -Name WAU_BypassListForUsers -Value 1 -PropertyType DWord -Force | Out-Null New-ItemProperty $regPath -Name WAU_BypassListForUsers -Value 1 -PropertyType DWord -Force | Out-Null
} }
#Set ACL for Authenticated Users on logfile #Log file and symlink initialization
$LogFile = "$WingetUpdatePath\logs\updates.log" . "$WingetUpdatePath\functions\Start-Init.ps1"
if (test-path $LogFile) { Start-Init
$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
}
#Security check #Security check
Write-host "`nChecking Mods Directory:" -ForegroundColor Yellow Write-host "`nChecking Mods Directory:" -ForegroundColor Yellow
@ -434,6 +425,9 @@ function Uninstall-WingetAutoUpdate {
if (!$NoClean) { if (!$NoClean) {
Remove-Item $InstallLocation -Force -Recurse 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 { else {
#Keep critical files #Keep critical files

View File

@ -111,11 +111,22 @@ if (Test-Network) {
#Get External ListPath if run as System #Get External ListPath if run as System
if ($WAUConfig.WAU_ListPath) { if ($WAUConfig.WAU_ListPath) {
Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))" $ListPathClean = $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))
if ($($WAUConfig.WAU_ListPath) -ne "GPO") { Write-Log "WAU uses External Lists from: $ListPathClean"
$NewList = Test-ListPath $WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/") $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation.TrimEnd(" ", "\") if ($ListPathClean -ne "GPO") {
$NewList = Test-ListPath $ListPathClean $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation.TrimEnd(" ", "\")
if ($ReachNoPath) { 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 $Script:ReachNoPath = $False
} }
if ($NewList) { if ($NewList) {
@ -139,10 +150,11 @@ if (Test-Network) {
#Get External ModsPath if run as System #Get External ModsPath if run as System
if ($WAUConfig.WAU_ModsPath) { if ($WAUConfig.WAU_ModsPath) {
Write-Log "WAU uses External Mods from: $($WAUConfig.WAU_ModsPath.TrimEnd(" ", "\", "/"))" $ModsPathClean = $($WAUConfig.WAU_ModsPath.TrimEnd(" ", "\", "/"))
$NewMods, $DeletedMods = Test-ModsPath $WAUConfig.WAU_ModsPath.TrimEnd(" ", "\", "/") $WAUConfig.InstallLocation.TrimEnd(" ", "\") Write-Log "WAU uses External Mods from: $ModsPathClean"
$NewMods, $DeletedMods = Test-ModsPath $ModsPathClean $WAUConfig.InstallLocation.TrimEnd(" ", "\")
if ($ReachNoPath) { 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 $Script:ReachNoPath = $False
} }
if ($NewMods -gt 0) { if ($NewMods -gt 0) {

View File

@ -5,6 +5,12 @@ function Invoke-PostUpdateActions {
#log #log
Write-Log "Running Post Update actions:" "yellow" 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" Write-Log "-> Checking prerequisites..." "yellow"
#Check if Visual C++ 2019 or 2022 installed #Check if Visual C++ 2019 or 2022 installed

View File

@ -5,16 +5,21 @@ function Start-Init {
#Config console output encoding #Config console output encoding
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
#Log Header $caller = Get-ChildItem $MyInvocation.PSCommandPath | Select-Object -Expand Name
$Log = "`n##################################################`n# CHECK FOR APP UPDATES - $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern)`n##################################################" if ($caller -eq "Winget-Upgrade.ps1") {
$Log | Write-host #Log Header
$Log = "`n##################################################`n# CHECK FOR APP UPDATES - $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern)`n##################################################"
#Logs initialisation $Log | Write-host
$Script:LogFile = "$WorkingDir\logs\updates.log" #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)) { if (!(Test-Path $LogFile)) {
#Create file if doesn't exist #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 #Set ACL for users on logfile
$NewAcl = Get-Acl -Path $LogFile $NewAcl = Get-Acl -Path $LogFile
@ -26,8 +31,28 @@ function Start-Init {
$NewAcl.SetAccessRule($fileSystemAccessRule) $NewAcl.SetAccessRule($fileSystemAccessRule)
Set-Acl -Path $LogFile -AclObject $NewAcl 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
}
#Log file #Check if Intune Management Extension Logs folder and WAU-updates.log exists, make symlink
$Log | out-file -filepath $LogFile -Append 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
}
} }