diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index 990595b..ac9d00c 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -337,6 +337,19 @@ function Install-WingetAutoUpdate { New-ItemProperty $regPath -Name WAU_BypassListForUsers -Value 1 -PropertyType DWord -Force | Out-Null } + #Set ACL for 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 + } + #Create Shortcuts if ($StartMenuShortcut) { if (!(Test-Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)")) { diff --git a/Winget-AutoUpdate/user-run.ps1 b/Winget-AutoUpdate/user-run.ps1 index 11a421f..9ca3a18 100644 --- a/Winget-AutoUpdate/user-run.ps1 +++ b/Winget-AutoUpdate/user-run.ps1 @@ -57,12 +57,12 @@ elseif ($Help) { } else { try { - #Run scheduled task - Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction Stop | Start-ScheduledTask -ErrorAction Stop #Starting check - Send notification $Message = $NotifLocale.local.outputs.output[6].message $MessageType = "info" Start-NotifTask $Title $Message $MessageType $Balise $OnClickAction + #Run scheduled task + Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction Stop | Start-ScheduledTask -ErrorAction Stop } catch { #Check failed - Just send notification diff --git a/install.bat b/install.bat index 6fcd9a2..1c0b08e 100644 --- a/install.bat +++ b/install.bat @@ -1,2 +1,5 @@ @echo off -powershell -Command "Get-ChildItem -Path '%~dp0' -Recurse | Unblock-File; Start-Process powershell.exe -Argument '-noprofile -executionpolicy bypass -file """%~dp0Winget-AutoUpdate-Install.ps1"" -UpdatesAtLogon'" -Verb RunAs \ No newline at end of file + +SET arguments=-UpdatesAtLogon -UpdatesInterval Weekly -StartMenuShortcut + +powershell -Command "Get-ChildItem -Path '%~dp0' -Recurse | Unblock-File; Start-Process powershell.exe -Argument '-noprofile -executionpolicy bypass -file """%~dp0Winget-AutoUpdate-Install.ps1"" %arguments%'" -Verb RunAs