Parameters, README, and fixes
parent
2fe4baec0a
commit
bc7dd12a60
10
README.md
10
README.md
|
@ -73,6 +73,16 @@ You can run the `Winget-AutoUpdate-Install.ps1` script with parameters :
|
||||||
**-Silent**
|
**-Silent**
|
||||||
Install Winget-AutoUpdate and prerequisites silently.
|
Install Winget-AutoUpdate and prerequisites silently.
|
||||||
|
|
||||||
|
**-MaxLogFiles**
|
||||||
|
Specify number of allowed log files.
|
||||||
|
Default is 3 of 0-99:
|
||||||
|
Setting MaxLogFiles to 0 don't delete any old archived log files.
|
||||||
|
Setting it to 1 keeps the original one and just let it grow.
|
||||||
|
|
||||||
|
**-MaxLogSize**
|
||||||
|
Specify the size of the log file in bytes before rotating.
|
||||||
|
Default is 1048576 = 1 MB
|
||||||
|
|
||||||
**-WingetUpdatePath**
|
**-WingetUpdatePath**
|
||||||
Specify Winget-AutoUpdate installation location. Default: `C:\ProgramData\Winget-AutoUpdate` (Recommended to leave default).
|
Specify Winget-AutoUpdate installation location. Default: `C:\ProgramData\Winget-AutoUpdate` (Recommended to leave default).
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,12 @@ https://github.com/Romanitho/Winget-AutoUpdate
|
||||||
.PARAMETER Silent
|
.PARAMETER Silent
|
||||||
Install Winget-AutoUpdate and prerequisites silently
|
Install Winget-AutoUpdate and prerequisites silently
|
||||||
|
|
||||||
|
.PARAMETER MaxLogFiles
|
||||||
|
Specify number of allowed log files (Default is 3 of 0-99: Setting MaxLogFiles to 0 don't delete any old archived log files, 1 keeps the original one and just let it grow)
|
||||||
|
|
||||||
|
.PARAMETER MaxLogSize
|
||||||
|
Specify the size of the log file in bytes before rotating. (Default is 1048576 = 1 MB)
|
||||||
|
|
||||||
.PARAMETER WingetUpdatePath
|
.PARAMETER WingetUpdatePath
|
||||||
Specify Winget-AutoUpdate installation localtion. Default: C:\ProgramData\Winget-AutoUpdate\
|
Specify Winget-AutoUpdate installation localtion. Default: C:\ProgramData\Winget-AutoUpdate\
|
||||||
|
|
||||||
|
@ -62,7 +68,7 @@ Install WAU with system and user context executions
|
||||||
Configure WAU to bypass the Black/White list when run in user context
|
Configure WAU to bypass the Black/White list when run in user context
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\Winget-AutoUpdate-Install.ps1 -Silent -DoNotUpdate
|
.\Winget-AutoUpdate-Install.ps1 -Silent -DoNotUpdate -MaxLogFiles 4 -MaxLogSize 2097152
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\Winget-AutoUpdate-Install.ps1 -Silent -UseWhiteList
|
.\Winget-AutoUpdate-Install.ps1 -Silent -UseWhiteList
|
||||||
|
@ -100,7 +106,9 @@ param(
|
||||||
[Parameter(Mandatory = $False)] [ValidateSet("Daily", "BiDaily", "Weekly", "BiWeekly", "Monthly", "Never")] [String] $UpdatesInterval = "Daily",
|
[Parameter(Mandatory = $False)] [ValidateSet("Daily", "BiDaily", "Weekly", "BiWeekly", "Monthly", "Never")] [String] $UpdatesInterval = "Daily",
|
||||||
[Parameter(Mandatory = $False)] [DateTime] $UpdatesAtTime = ("06am"),
|
[Parameter(Mandatory = $False)] [DateTime] $UpdatesAtTime = ("06am"),
|
||||||
[Parameter(Mandatory = $False)] [Switch] $BypassListForUsers = $false,
|
[Parameter(Mandatory = $False)] [Switch] $BypassListForUsers = $false,
|
||||||
[Parameter(Mandatory = $False)] [Switch] $InstallUserContext = $false
|
[Parameter(Mandatory = $False)] [Switch] $InstallUserContext = $false,
|
||||||
|
[Parameter(Mandatory = $False)] [ValidateRange(0,99)] [int32] $MaxLogFiles = 3,
|
||||||
|
[Parameter(Mandatory = $False)] [int64] $MaxLogSize = 1048576 # in bytes, default is 1048576 = 1 MB
|
||||||
)
|
)
|
||||||
|
|
||||||
<# APP INFO #>
|
<# APP INFO #>
|
||||||
|
@ -337,6 +345,8 @@ function Install-WingetAutoUpdate {
|
||||||
New-ItemProperty $regPath -Name WAU_NotificationLevel -Value $NotificationLevel -Force | Out-Null
|
New-ItemProperty $regPath -Name WAU_NotificationLevel -Value $NotificationLevel -Force | Out-Null
|
||||||
New-ItemProperty $regPath -Name WAU_UpdatePrerelease -Value 0 -PropertyType DWord -Force | Out-Null
|
New-ItemProperty $regPath -Name WAU_UpdatePrerelease -Value 0 -PropertyType DWord -Force | Out-Null
|
||||||
New-ItemProperty $regPath -Name WAU_PostUpdateActions -Value 0 -PropertyType DWord -Force | Out-Null
|
New-ItemProperty $regPath -Name WAU_PostUpdateActions -Value 0 -PropertyType DWord -Force | Out-Null
|
||||||
|
New-ItemProperty $regPath -Name WAU_MaxLogFiles -Value $MaxLogFiles -PropertyType DWord -Force | Out-Null
|
||||||
|
New-ItemProperty $regPath -Name WAU_MaxLogSize -Value $MaxLogSize -PropertyType DWord -Force | Out-Null
|
||||||
if ($DisableWAUAutoUpdate) {
|
if ($DisableWAUAutoUpdate) {
|
||||||
New-ItemProperty $regPath -Name WAU_DisableAutoUpdate -Value 1 -Force | Out-Null
|
New-ItemProperty $regPath -Name WAU_DisableAutoUpdate -Value 1 -Force | Out-Null
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,16 @@ function Invoke-PostUpdateActions {
|
||||||
Write-Log "-> Notification level setting was missing. Fixed with 'Full' option."
|
Write-Log "-> Notification level setting was missing. Fixed with 'Full' option."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Set WAU_MaxLogFiles/WAU_MaxLogSize if not set
|
||||||
|
$MaxLogFiles = Get-ItemProperty $regPath -Name WAU_MaxLogFiles -ErrorAction SilentlyContinue
|
||||||
|
if (!$MaxLogFiles) {
|
||||||
|
New-ItemProperty $regPath -Name WAU_MaxLogFiles -Value 3 -PropertyType DWord -Force | Out-Null
|
||||||
|
New-ItemProperty $regPath -Name WAU_MaxLogSize -Value 1048576 -PropertyType DWord -Force | Out-Null
|
||||||
|
|
||||||
|
#log
|
||||||
|
Write-Log "-> MaxLogFiles/MaxLogSize setting was missing. Fixed with 3/1048576 (in bytes, default is 1048576 = 1 MB)."
|
||||||
|
}
|
||||||
|
|
||||||
#Convert about.xml if exists (previous WAU versions) to reg
|
#Convert about.xml if exists (previous WAU versions) to reg
|
||||||
$WAUAboutPath = "$WorkingDir\config\about.xml"
|
$WAUAboutPath = "$WorkingDir\config\about.xml"
|
||||||
if (test-path $WAUAboutPath) {
|
if (test-path $WAUAboutPath) {
|
||||||
|
|
|
@ -6,10 +6,22 @@ function Start-Init {
|
||||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||||
|
|
||||||
# Maximum number of log files to keep. Default is 3. Setting MaxLogFiles to 0 will keep all log files.
|
# Maximum number of log files to keep. Default is 3. Setting MaxLogFiles to 0 will keep all log files.
|
||||||
|
$MaxLogFiles = Get-ItemPropertyvalue -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate -Name "WAU_MaxLogFiles" -ErrorAction SilentlyContinue
|
||||||
|
if ($null = $MaxLogFiles) {
|
||||||
[int32] $MaxLogFiles = 3
|
[int32] $MaxLogFiles = 3
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[int32] $MaxLogFiles = $MaxLogFiles
|
||||||
|
}
|
||||||
|
|
||||||
# Maximum size of log file.
|
# Maximum size of log file.
|
||||||
|
$MaxLogSize = Get-ItemPropertyvalue -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate -Name "WAU_MaxLogSize" -ErrorAction SilentlyContinue
|
||||||
|
if (!$MaxLogSize) {
|
||||||
[int64] $MaxLogSize = 1048576 # in bytes, default is 1048576 = 1 MB
|
[int64] $MaxLogSize = 1048576 # in bytes, default is 1048576 = 1 MB
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[int64] $MaxLogSize = $MaxLogSize
|
||||||
|
}
|
||||||
|
|
||||||
#Log Header
|
#Log Header
|
||||||
$Log = "`n##################################################`n# CHECK FOR APP UPDATES - $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern)`n##################################################"
|
$Log = "`n##################################################`n# CHECK FOR APP UPDATES - $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern)`n##################################################"
|
||||||
|
|
Loading…
Reference in New Issue