...and, missing list error too!
parent
7c0c9dcb30
commit
50b2d383c4
|
@ -82,10 +82,10 @@ else {
|
|||
Start-Sleep 3
|
||||
}
|
||||
|
||||
#Test if there was a winget error as System/User
|
||||
if (Test-Path "$WorkingDir\winget_error.txt") {
|
||||
#Test if there was a list/winget error as System/User
|
||||
if (Test-Path "$WorkingDir\*_error.txt") {
|
||||
$MessageType = "error"
|
||||
Remove-Item "$WorkingDir\winget_error.txt" -Force
|
||||
Remove-Item "$WorkingDir\*_error.txt" -Force
|
||||
}
|
||||
elseif (Test-Path "${env:TEMP}\winget_error.txt") {
|
||||
$MessageType = "error"
|
||||
|
|
|
@ -36,6 +36,14 @@ if ($IsSystem) {
|
|||
Add-ScopeMachine $SettingsPath
|
||||
}
|
||||
|
||||
#Delete previous list/winget_error (if they exist) as System/User
|
||||
if ($IsSystem -and (Test-Path "$WorkingDir\*_error.txt")) {
|
||||
Remove-Item "$WorkingDir\*_error.txt" -Force
|
||||
}
|
||||
elseif (!$IsSystem -and (Test-Path "${env:TEMP}\winget_error.txt")) {
|
||||
Remove-Item "${env:TEMP}\winget_error.txt" -Force
|
||||
}
|
||||
|
||||
#Get Notif Locale function
|
||||
$LocaleDisplayName = Get-NotifLocale
|
||||
Write-Log "Notification Level: $($WAUConfig.WAU_NotificationLevel). Notification Language: $LocaleDisplayName" "Cyan"
|
||||
|
@ -83,7 +91,16 @@ if (Test-Network) {
|
|||
Write-Log "List is up to date." "Green"
|
||||
}
|
||||
else {
|
||||
Write-Log "List doesn't exist!" "Red"
|
||||
Write-Log "Critical: List doesn't exist, exiting..." "Red"
|
||||
$path = "$WorkingDir\list_error.txt"
|
||||
New-Item "$path" -Force
|
||||
|
||||
#Setting file rights for everyone (so that it can be deleted by User in User-Run.ps1)
|
||||
$rule= New-Object System.Security.AccessControl.FileSystemAccessRule ('Everyone', 'FullControl', 'Allow')
|
||||
$acl = Get-ACL $path
|
||||
$acl.SetAccessRule($rule)
|
||||
Set-ACL -Path $path -AclObject $acl
|
||||
|
||||
Exit 1
|
||||
}
|
||||
}
|
||||
|
@ -110,14 +127,6 @@ if (Test-Network) {
|
|||
}
|
||||
}
|
||||
|
||||
#Delete previous winget_error (if exists) as System/User
|
||||
if ($IsSystem -and (Test-Path "$WorkingDir\winget_error.txt")) {
|
||||
Remove-Item "$WorkingDir\winget_error.txt" -Force
|
||||
}
|
||||
elseif (!$IsSystem -and (Test-Path "${env:TEMP}\winget_error.txt")) {
|
||||
Remove-Item "${env:TEMP}\winget_error.txt" -Force
|
||||
}
|
||||
|
||||
#Get White or Black list
|
||||
if ($WAUConfig.WAU_UseWhiteList -eq 1) {
|
||||
Write-Log "WAU uses White List config"
|
||||
|
|
Loading…
Reference in New Issue