Set ACL if log file exists
parent
65f0d496b5
commit
840fad03da
|
@ -337,6 +337,19 @@ 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 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
|
#Create Shortcuts
|
||||||
if ($StartMenuShortcut) {
|
if ($StartMenuShortcut) {
|
||||||
if (!(Test-Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)")) {
|
if (!(Test-Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)")) {
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
@echo off
|
@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
|
|
||||||
|
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
|
Loading…
Reference in New Issue