Cleaner logs

pull/87/head
Romain 2022-05-23 09:35:49 +02:00
parent 9a96201372
commit f552c5b261
2 changed files with 10 additions and 6 deletions

View File

@ -1,7 +1,8 @@
#Function to make actions post WAU update #Function to make actions post WAU update
function Invoke-PostUpdateActions { function Invoke-PostUpdateActions {
#log
Write-Log "Running Post Update actions..." "yellow" Write-Log "Running Post Update actions..." "yellow"
#Create WAU Regkey if not present #Create WAU Regkey if not present
@ -19,7 +20,7 @@ function Invoke-PostUpdateActions {
New-ItemProperty $regPath -Name WAU_UpdatePrerelease -Value 0 -PropertyType DWord -Force New-ItemProperty $regPath -Name WAU_UpdatePrerelease -Value 0 -PropertyType DWord -Force
#log #log
Write-Log "$regPath created." "green" Write-Log "-> $regPath created." "green"
} }
#Convert about.xml if exists (previous WAU versions) to reg #Convert about.xml if exists (previous WAU versions) to reg
@ -34,7 +35,7 @@ function Invoke-PostUpdateActions {
Remove-Item $WAUAboutPath -Force -Confirm:$false Remove-Item $WAUAboutPath -Force -Confirm:$false
#log #log
Write-Log "$WAUAboutPath converted." "green" Write-Log "-> $WAUAboutPath converted." "green"
} }
#Convert config.xml if exists (previous WAU versions) to reg #Convert config.xml if exists (previous WAU versions) to reg
@ -50,7 +51,7 @@ function Invoke-PostUpdateActions {
Remove-Item $WAUConfigPath -Force -Confirm:$false Remove-Item $WAUConfigPath -Force -Confirm:$false
#log #log
Write-Log "$WAUConfigPath converted." "green" Write-Log "-> $WAUConfigPath converted." "green"
} }
#Remove old functions #Remove old functions
@ -64,7 +65,7 @@ function Invoke-PostUpdateActions {
Remove-Item $FileName -Force -Confirm:$false Remove-Item $FileName -Force -Confirm:$false
#log #log
Write-Log "$FileName removed." "green" Write-Log "-> $FileName removed." "green"
} }
} }
@ -74,4 +75,7 @@ function Invoke-PostUpdateActions {
#Get updated WAU Config #Get updated WAU Config
$Script:WAUConfig = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" $Script:WAUConfig = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
#log
Write-Log "Post Update actions finished" "green"
} }

View File

@ -75,7 +75,7 @@ if (Test-Network){
#Log list of app to update #Log list of app to update
foreach ($app in $outdated){ foreach ($app in $outdated){
#List available updates #List available updates
$Log = "Available update : $($app.Name). Current version : $($app.Version). Available version : $($app.AvailableVersion)." $Log = "-> Available update : $($app.Name). Current version : $($app.Version). Available version : $($app.AvailableVersion)."
$Log | Write-host $Log | Write-host
$Log | out-file -filepath $LogFile -Append $Log | out-file -filepath $LogFile -Append
} }