commit
6582759014
|
@ -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)")) {
|
||||||
|
|
|
@ -57,12 +57,12 @@ elseif ($Help) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
#Run scheduled task
|
|
||||||
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction Stop | Start-ScheduledTask -ErrorAction Stop
|
|
||||||
#Starting check - Send notification
|
#Starting check - Send notification
|
||||||
$Message = $NotifLocale.local.outputs.output[6].message
|
$Message = $NotifLocale.local.outputs.output[6].message
|
||||||
$MessageType = "info"
|
$MessageType = "info"
|
||||||
Start-NotifTask $Title $Message $MessageType $Balise $OnClickAction
|
Start-NotifTask $Title $Message $MessageType $Balise $OnClickAction
|
||||||
|
#Run scheduled task
|
||||||
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction Stop | Start-ScheduledTask -ErrorAction Stop
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
#Check failed - Just send notification
|
#Check failed - Just send notification
|
||||||
|
|
|
@ -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