pull/683/head
Romain 2024-09-02 23:11:33 +02:00
parent d987820bf8
commit 7ef9bf0c2c
3 changed files with 11 additions and 8 deletions

5
.github/cspell.json vendored
View File

@ -34,7 +34,10 @@
"msiexec", "msiexec",
"VERYSILENT", "VERYSILENT",
"SUPPRESSMSGBOXES", "SUPPRESSMSGBOXES",
"subfolders" "subfolders",
"explorerprocesses",
"SASURL",
"LASTEXITCODE"
], ],
"ignorePaths": [ "ignorePaths": [
".github/*", ".github/*",

View File

@ -314,7 +314,7 @@ $Script:IsElevated = $CurrentPrincipal.IsInRole([Security.Principal.WindowsBuilt
$WAURegKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" $WAURegKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\"
$Script:WAUInstallLocation = Get-ItemProperty $WAURegKey -ErrorAction SilentlyContinue | Select-Object -ExpandProperty InstallLocation $Script:WAUInstallLocation = Get-ItemProperty $WAURegKey -ErrorAction SilentlyContinue | Select-Object -ExpandProperty InstallLocation
#LogPath initialisation #LogPath initialization
if (!($LogPath)) { if (!($LogPath)) {
#If LogPath is not set, get WAU log path #If LogPath is not set, get WAU log path
if ($WAUInstallLocation) { if ($WAUInstallLocation) {
@ -326,7 +326,7 @@ if (!($LogPath)) {
} }
} }
#Logs initialisation #Logs initialization
if (!(Test-Path $LogPath)) { if (!(Test-Path $LogPath)) {
New-Item -ItemType Directory -Force -Path $LogPath | Out-Null New-Item -ItemType Directory -Force -Path $LogPath | Out-Null
} }
@ -372,7 +372,7 @@ if ($IsElevated -eq $True) {
$null = Update-Winget $null = Update-Winget
#Reload Winget command #Reload Winget command
$Script:Winget = Get-WingetCmd $Script:Winget = Get-WingetCmd
#Run Scope Machine funtion #Run Scope Machine function
Add-ScopeMachine Add-ScopeMachine
} }
else { else {

View File

@ -13,7 +13,7 @@ $null = cmd /c ''
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$Script:ProgressPreference = 'SilentlyContinue' $Script:ProgressPreference = 'SilentlyContinue'
#Log initialisation #Log initialization
$LogFile = "$WorkingDir\logs\updates.log" $LogFile = "$WorkingDir\logs\updates.log"
#Check if running account is system or interactive logon #Check if running account is system or interactive logon
@ -109,14 +109,14 @@ if ($IsSystem) {
#LogRotation if System #LogRotation if System
$LogRotate = Invoke-LogRotation $LogFile $MaxLogFiles $MaxLogSize $LogRotate = Invoke-LogRotation $LogFile $MaxLogFiles $MaxLogSize
if ($LogRotate -eq $False) { if ($LogRotate -eq $False) {
Write-ToLog "An Exception occured during Log Rotation..." Write-ToLog "An Exception occurred during Log Rotation..."
} }
#Run post update actions if necessary if run as System #Run post update actions if necessary if run as System
if (!($WAUConfig.WAU_PostUpdateActions -eq 0)) { if (!($WAUConfig.WAU_PostUpdateActions -eq 0)) {
Invoke-PostUpdateActions Invoke-PostUpdateActions
} }
#Run Scope Machine funtion if run as System #Run Scope Machine function if run as System
Add-ScopeMachine Add-ScopeMachine
} }
@ -402,7 +402,7 @@ if (Test-Network) {
Write-ToLog "No explorer process found / Nobody interactively logged on..." Write-ToLog "No explorer process found / Nobody interactively logged on..."
} }
Else { Else {
#Get Winget system apps to excape them befor running user context #Get Winget system apps to escape them before running user context
Write-ToLog "User logged on, get a list of installed Winget apps in System context..." Write-ToLog "User logged on, get a list of installed Winget apps in System context..."
Get-WingetSystemApps Get-WingetSystemApps