Write-ToLog
parent
7aea648d46
commit
a16313b367
|
@ -21,7 +21,7 @@ https://github.com/Romanitho/Winget-AutoUpdate
|
|||
param(
|
||||
[Parameter(Mandatory = $False)] [Switch] $Logs = $false,
|
||||
[Parameter(Mandatory = $False)] [Switch] $Help = $false,
|
||||
[Parameter(Mandatory = $False)] [String] $NotifApproved,
|
||||
[Parameter(Mandatory = $False)] [String] $NotifApproved
|
||||
)
|
||||
|
||||
function Test-WAUisRunning {
|
||||
|
@ -103,8 +103,11 @@ else {
|
|||
$MessageType = "success"
|
||||
$Message = $NotifLocale.local.outputs.output[9].message
|
||||
}
|
||||
$IsUserApprovalEnable = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name WAU_UserApproval -ErrorAction SilentlyContinue).WAU_UserApproval
|
||||
if ($IsUserApprovalEnable -ne "1"){
|
||||
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss -UserRun
|
||||
}
|
||||
}
|
||||
catch {
|
||||
#Check failed - Just send notification
|
||||
$Message = $NotifLocale.local.outputs.output[7].message
|
||||
|
|
|
@ -238,23 +238,23 @@ if (Test-Network) {
|
|||
|
||||
#Ask user to approve, if configured
|
||||
if ($WAUConfig.WAU_UserApproval -eq 1){
|
||||
Write-Log "User Approval feature enabled."
|
||||
Write-ToLog "User Approval feature enabled."
|
||||
|
||||
#Check for approved tag
|
||||
$WAUNotifApproved = "$WorkingDir/Config/NotifApproved.txt"
|
||||
if (Test-Path $WAUNotifApproved) {
|
||||
Write-Log "-> User approved notification."
|
||||
Write-ToLog "-> User approved notification."
|
||||
Remove-Item $WAUNotifApproved -Force -Confirm:$false
|
||||
}
|
||||
else {
|
||||
$UserApprovalReturn = Invoke-UserApproval $outdated
|
||||
if ($UserApprovalReturn -eq 0){
|
||||
Write-Log "-> User approval requested. Waiting for user to approve available updates... Closing for now."
|
||||
Write-ToLog "-> User approval requested. Waiting for user to approve available updates... Closing for now."
|
||||
#Closing job, waiting for user approval
|
||||
Exit 0
|
||||
}
|
||||
else{
|
||||
Write-log "-> No update to request to user."
|
||||
Write-ToLog "-> No update to request to user."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue