Minor format changes
parent
1320e7d356
commit
6c118323f9
|
@ -91,28 +91,57 @@
|
|||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Alias('S')] [Switch] $Silent = $false,
|
||||
[Alias('Path')] [String] $WingetUpdatePath = "$env:ProgramData\Winget-AutoUpdate",
|
||||
[Alias('List')] [String] $ListPath,
|
||||
[Alias('Mods')] [String] $ModsPath,
|
||||
[Alias('AzureBlobURL')] [String] $AzureBlobSASURL,
|
||||
[Switch] $DoNotUpdate = $false,
|
||||
[Switch] $DisableWAUAutoUpdate = $false,
|
||||
[Switch] $RunOnMetered = $false,
|
||||
[Switch] $Uninstall = $false,
|
||||
[Switch] $NoClean = $false,
|
||||
[Switch] $DesktopShortcut = $false,
|
||||
[Switch] $StartMenuShortcut = $false,
|
||||
[Switch] $UseWhiteList = $false,
|
||||
[ValidateSet('Full', 'SuccessOnly', 'None')] [String] $NotificationLevel = 'Full',
|
||||
[Switch] $UpdatesAtLogon = $false,
|
||||
[ValidateSet('Daily', 'BiDaily', 'Weekly', 'BiWeekly', 'Monthly', 'Never')] [String] $UpdatesInterval = 'Daily',
|
||||
[DateTime] $UpdatesAtTime = ('06am'),
|
||||
[Switch] $BypassListForUsers = $false,
|
||||
[Switch] $InstallUserContext = $false,
|
||||
[ValidateRange(0, 99)] [int] $MaxLogFiles = 3,
|
||||
[long] $MaxLogSize = 1048576 # in bytes, default is 1048576 = 1 MB
|
||||
param (
|
||||
[Alias('S')]
|
||||
[Switch]
|
||||
$Silent = $false,
|
||||
[Alias('Path')]
|
||||
[String]
|
||||
$WingetUpdatePath = "$env:ProgramData\Winget-AutoUpdate",
|
||||
[Alias('List')]
|
||||
[String]
|
||||
$ListPath,
|
||||
[Alias('Mods')]
|
||||
[String]
|
||||
$ModsPath,
|
||||
[Alias('AzureBlobURL')]
|
||||
[String]
|
||||
$AzureBlobSASURL,
|
||||
[Switch]
|
||||
$DoNotUpdate = $false,
|
||||
[Switch]
|
||||
$DisableWAUAutoUpdate = $false,
|
||||
[Switch]
|
||||
$RunOnMetered = $false,
|
||||
[Switch]
|
||||
$Uninstall = $false,
|
||||
[Switch]
|
||||
$NoClean = $false,
|
||||
[Switch]
|
||||
$DesktopShortcut = $false,
|
||||
[Switch]
|
||||
$StartMenuShortcut = $false,
|
||||
[Switch]
|
||||
$UseWhiteList = $false,
|
||||
[ValidateSet('Full', 'SuccessOnly', 'None')]
|
||||
[String]
|
||||
$NotificationLevel = 'Full',
|
||||
[Switch]
|
||||
$UpdatesAtLogon = $false,
|
||||
[ValidateSet('Daily', 'BiDaily', 'Weekly', 'BiWeekly', 'Monthly', 'Never')]
|
||||
[String]
|
||||
$UpdatesInterval = 'Daily',
|
||||
[DateTime]
|
||||
$UpdatesAtTime = ('06am'),
|
||||
[Switch]
|
||||
$BypassListForUsers = $false,
|
||||
[Switch]
|
||||
$InstallUserContext = $false,
|
||||
[ValidateRange(0, 99)]
|
||||
[int]
|
||||
$MaxLogFiles = 3,
|
||||
[long]
|
||||
$MaxLogSize = 1048576 # in bytes, default is 1048576 = 1 MB
|
||||
)
|
||||
|
||||
|
||||
|
@ -203,11 +232,11 @@ function Install-WinGet
|
|||
}
|
||||
|
||||
#Current: v1.5.2201 = 1.20.2201.0 = 2023.808.2243.0
|
||||
If ([Version]$TestWinGet.Version -ge '2023.808.2243.0')
|
||||
if ([Version]$TestWinGet.Version -ge '2023.808.2243.0')
|
||||
{
|
||||
Write-Host -Object 'Winget is Installed' -ForegroundColor Green
|
||||
}
|
||||
Else
|
||||
else
|
||||
{
|
||||
Write-Host -Object '-> Winget is not installed:'
|
||||
|
||||
|
@ -646,13 +675,9 @@ function Add-Shortcut
|
|||
param
|
||||
(
|
||||
$Target,
|
||||
|
||||
$Shortcut,
|
||||
|
||||
$Arguments,
|
||||
|
||||
$Icon,
|
||||
|
||||
$Description
|
||||
)
|
||||
$WScriptShell = New-Object -ComObject WScript.Shell
|
||||
|
@ -678,7 +703,7 @@ if ("$env:PROCESSOR_ARCHITEW6432" -ne 'ARM64')
|
|||
if (Test-Path -Path "$($env:windir)\SysNative\WindowsPowerShell\v1.0\powershell.exe")
|
||||
{
|
||||
Start-Process -FilePath "$($env:windir)\SysNative\WindowsPowerShell\v1.0\powershell.exe" -Wait -NoNewWindow -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command $($MyInvocation.line)"
|
||||
Exit $lastexitcode
|
||||
exit $lastexitcode
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,16 +18,18 @@
|
|||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Switch] $Logs = $False,
|
||||
[Switch] $Help = $False
|
||||
param (
|
||||
[Switch]
|
||||
$Logs = $False,
|
||||
[Switch]
|
||||
$Help = $False
|
||||
)
|
||||
|
||||
function Test-WAUisRunning
|
||||
{
|
||||
If (((Get-ScheduledTask -TaskName 'Winget-AutoUpdate' -ErrorAction SilentlyContinue).State -eq 'Running') -or ((Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -ErrorAction SilentlyContinue).State -eq 'Running'))
|
||||
if (((Get-ScheduledTask -TaskName 'Winget-AutoUpdate' -ErrorAction SilentlyContinue).State -eq 'Running') -or ((Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -ErrorAction SilentlyContinue).State -eq 'Running'))
|
||||
{
|
||||
Return $True
|
||||
return $True
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +86,7 @@ else
|
|||
$MessageType = 'info'
|
||||
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss -UserRun
|
||||
# Sleep until the task is done
|
||||
While (Test-WAUisRunning)
|
||||
while (Test-WAUisRunning)
|
||||
{
|
||||
Start-Sleep -Seconds 3
|
||||
}
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Switch] $NoClean = $false
|
||||
param (
|
||||
[Switch]
|
||||
$NoClean = $false
|
||||
)
|
||||
|
||||
Write-Host -Object "`n"
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
$Script:WorkingDir = $PSScriptRoot
|
||||
|
||||
# Get Functions
|
||||
Get-ChildItem -Path "$WorkingDir\functions" | ForEach-Object { . $_.FullName }
|
||||
Get-ChildItem -Path "$WorkingDir\functions" | ForEach-Object {
|
||||
. $_.FullName
|
||||
}
|
||||
|
||||
<# MAIN #>
|
||||
|
||||
|
@ -18,54 +20,65 @@ Start-Init
|
|||
$Script:WAUConfig = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate')
|
||||
|
||||
#Log running context and more...
|
||||
if ($IsSystem) {
|
||||
if ($IsSystem)
|
||||
{
|
||||
Write-ToLog 'Running in System context'
|
||||
|
||||
#Get and set Domain/Local Policies (GPO)
|
||||
$ActivateGPOManagement, $ChangedSettings = Get-Policies
|
||||
if ($ActivateGPOManagement) {
|
||||
if ($ActivateGPOManagement)
|
||||
{
|
||||
Write-ToLog 'Activated WAU GPO Management detected, comparing...'
|
||||
if ($null -ne $ChangedSettings -and $ChangedSettings -ne 0) {
|
||||
if ($null -ne $ChangedSettings -and $ChangedSettings -ne 0)
|
||||
{
|
||||
Write-ToLog 'Changed settings detected and applied' 'Yellow'
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog 'No Changed settings detected' 'Yellow'
|
||||
}
|
||||
}
|
||||
|
||||
# Maximum number of log files to keep. Default is 3. Setting MaxLogFiles to 0 will keep all log files.
|
||||
$MaxLogFiles = $WAUConfig.WAU_MaxLogFiles
|
||||
if ($null -eq $MaxLogFiles) {
|
||||
[int] $MaxLogFiles = 3
|
||||
if ($null -eq $MaxLogFiles)
|
||||
{
|
||||
[int]$MaxLogFiles = 3
|
||||
}
|
||||
else {
|
||||
[int] $MaxLogFiles = $MaxLogFiles
|
||||
else
|
||||
{
|
||||
[int]$MaxLogFiles = $MaxLogFiles
|
||||
}
|
||||
|
||||
# Maximum size of log file.
|
||||
$MaxLogSize = $WAUConfig.WAU_MaxLogSize
|
||||
if (!$MaxLogSize) {
|
||||
[long] $MaxLogSize = 1048576 # in bytes, default is 1048576 = 1 MB
|
||||
if (!$MaxLogSize)
|
||||
{
|
||||
[long]$MaxLogSize = 1048576 # in bytes, default is 1048576 = 1 MB
|
||||
}
|
||||
else {
|
||||
[long] $MaxLogSize = $MaxLogSize
|
||||
else
|
||||
{
|
||||
[long]$MaxLogSize = $MaxLogSize
|
||||
}
|
||||
|
||||
#LogRotation if System
|
||||
$LogRotate = Invoke-LogRotation $LogFile $MaxLogFiles $MaxLogSize
|
||||
if ($LogRotate -eq $False) {
|
||||
if ($LogRotate -eq $False)
|
||||
{
|
||||
Write-ToLog 'An Exception occured during Log Rotation...'
|
||||
}
|
||||
|
||||
#Run post update actions if necessary if run as System
|
||||
if (!($WAUConfig.WAU_PostUpdateActions -eq 0)) {
|
||||
if (!($WAUConfig.WAU_PostUpdateActions -eq 0))
|
||||
{
|
||||
Invoke-PostUpdateActions
|
||||
}
|
||||
#Run Scope Machine funtion if run as System
|
||||
$SettingsPath = "$Env:windir\system32\config\systemprofile\AppData\Local\Microsoft\WinGet\Settings\defaultState\settings.json"
|
||||
Add-ScopeMachine $SettingsPath
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog 'Running in User context'
|
||||
}
|
||||
|
||||
|
@ -74,158 +87,197 @@ $LocaleDisplayName = Get-NotifLocale
|
|||
Write-ToLog "Notification Level: $($WAUConfig.WAU_NotificationLevel). Notification Language: $LocaleDisplayName" 'Cyan'
|
||||
|
||||
#Check network connectivity
|
||||
if (Test-Network) {
|
||||
if (Test-Network)
|
||||
{
|
||||
#Check if Winget is installed and get Winget cmd
|
||||
$TestWinget = Get-WingetCmd
|
||||
|
||||
if ($TestWinget) {
|
||||
if ($TestWinget)
|
||||
{
|
||||
#Get Current Version
|
||||
$WAUCurrentVersion = $WAUConfig.DisplayVersion
|
||||
Write-ToLog "WAU current version: $WAUCurrentVersion"
|
||||
if ($IsSystem) {
|
||||
if ($IsSystem)
|
||||
{
|
||||
#Check if WAU update feature is enabled or not if run as System
|
||||
$WAUDisableAutoUpdate = $WAUConfig.WAU_DisableAutoUpdate
|
||||
#If yes then check WAU update if run as System
|
||||
if ($WAUDisableAutoUpdate -eq 1) {
|
||||
if ($WAUDisableAutoUpdate -eq 1)
|
||||
{
|
||||
Write-ToLog 'WAU AutoUpdate is Disabled.' 'Gray'
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog 'WAU AutoUpdate is Enabled.' 'Green'
|
||||
#Get Available Version
|
||||
$Script:WAUAvailableVersion = Get-WAUAvailableVersion
|
||||
#Compare
|
||||
if ([version]$WAUAvailableVersion.Replace('-', '.') -ne [version]$WAUCurrentVersion.Replace('-', '.')) {
|
||||
if ([version]$WAUAvailableVersion.Replace('-', '.') -ne [version]$WAUCurrentVersion.Replace('-', '.'))
|
||||
{
|
||||
#If new version is available, update it
|
||||
Write-ToLog "WAU Available version: $WAUAvailableVersion" 'Yellow'
|
||||
Update-WAU
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog 'WAU is up to date.' 'Green'
|
||||
}
|
||||
}
|
||||
|
||||
#Delete previous list_/winget_error (if they exist) if run as System
|
||||
if (Test-Path -Path "$WorkingDir\logs\error.txt") {
|
||||
if (Test-Path -Path "$WorkingDir\logs\error.txt")
|
||||
{
|
||||
Remove-Item -Path "$WorkingDir\logs\error.txt" -Force
|
||||
}
|
||||
|
||||
#Get External ListPath if run as System
|
||||
if ($WAUConfig.WAU_ListPath) {
|
||||
if ($WAUConfig.WAU_ListPath)
|
||||
{
|
||||
$ListPathClean = $($WAUConfig.WAU_ListPath.TrimEnd(' ', '\', '/'))
|
||||
Write-ToLog "WAU uses External Lists from: $ListPathClean"
|
||||
if ($ListPathClean -ne 'GPO') {
|
||||
if ($ListPathClean -ne 'GPO')
|
||||
{
|
||||
$NewList = Test-ListPath $ListPathClean $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation.TrimEnd(' ', '\')
|
||||
if ($ReachNoPath) {
|
||||
if ($ReachNoPath)
|
||||
{
|
||||
Write-ToLog "Couldn't reach/find/compare/copy from $ListPathClean..." 'Red'
|
||||
if ($ListPathClean -notlike 'http*') {
|
||||
if (Test-Path -Path "$ListPathClean" -PathType Leaf) {
|
||||
if ($ListPathClean -notlike 'http*')
|
||||
{
|
||||
if (Test-Path -Path "$ListPathClean" -PathType Leaf)
|
||||
{
|
||||
Write-ToLog 'PATH must end with a Directory, not a File...' 'Red'
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($ListPathClean -match '_apps.txt') {
|
||||
else
|
||||
{
|
||||
if ($ListPathClean -match '_apps.txt')
|
||||
{
|
||||
Write-ToLog 'PATH must end with a Directory, not a File...' 'Red'
|
||||
}
|
||||
}
|
||||
$Script:ReachNoPath = $False
|
||||
}
|
||||
if ($NewList) {
|
||||
if ($NewList)
|
||||
{
|
||||
Write-ToLog "Newer List downloaded/copied to local path: $($WAUConfig.InstallLocation.TrimEnd(' ', '\'))" 'Yellow'
|
||||
}
|
||||
else {
|
||||
if ($WAUConfig.WAU_UseWhiteList -and (Test-Path -Path "$WorkingDir\included_apps.txt")) {
|
||||
else
|
||||
{
|
||||
if ($WAUConfig.WAU_UseWhiteList -and (Test-Path -Path "$WorkingDir\included_apps.txt"))
|
||||
{
|
||||
Write-ToLog 'List (white) is up to date.' 'Green'
|
||||
}
|
||||
elseif (!$WAUConfig.WAU_UseWhiteList -and (Test-Path -Path "$WorkingDir\excluded_apps.txt")) {
|
||||
elseif (!$WAUConfig.WAU_UseWhiteList -and (Test-Path -Path "$WorkingDir\excluded_apps.txt"))
|
||||
{
|
||||
Write-ToLog 'List (black) is up to date.' 'Green'
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog "Critical: White/Black List doesn't exist, exiting..." 'Red'
|
||||
New-Item -Path "$WorkingDir\logs\error.txt" -Value "White/Black List doesn't exist" -Force
|
||||
Exit 1
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Get External ModsPath if run as System
|
||||
if ($WAUConfig.WAU_ModsPath) {
|
||||
if ($WAUConfig.WAU_ModsPath)
|
||||
{
|
||||
$ModsPathClean = $($WAUConfig.WAU_ModsPath.TrimEnd(' ', '\', '/'))
|
||||
Write-ToLog "WAU uses External Mods from: $ModsPathClean"
|
||||
if ($WAUConfig.WAU_AzureBlobSASURL) {
|
||||
if ($WAUConfig.WAU_AzureBlobSASURL)
|
||||
{
|
||||
$NewMods, $DeletedMods = Test-ModsPath $ModsPathClean $WAUConfig.InstallLocation.TrimEnd(' ', '\') $WAUConfig.WAU_AzureBlobSASURL.TrimEnd(' ')
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$NewMods, $DeletedMods = Test-ModsPath $ModsPathClean $WAUConfig.InstallLocation.TrimEnd(' ', '\')
|
||||
}
|
||||
if ($ReachNoPath) {
|
||||
if ($ReachNoPath)
|
||||
{
|
||||
Write-ToLog "Couldn't reach/find/compare/copy from $ModsPathClean..." 'Red'
|
||||
$Script:ReachNoPath = $False
|
||||
}
|
||||
if ($NewMods -gt 0) {
|
||||
if ($NewMods -gt 0)
|
||||
{
|
||||
Write-ToLog "$NewMods newer Mods downloaded/copied to local path: $($WAUConfig.InstallLocation.TrimEnd(' ', '\'))\mods" 'Yellow'
|
||||
}
|
||||
else {
|
||||
if (Test-Path -Path "$WorkingDir\mods\*.ps1") {
|
||||
else
|
||||
{
|
||||
if (Test-Path -Path "$WorkingDir\mods\*.ps1")
|
||||
{
|
||||
Write-ToLog 'Mods are up to date.' 'Green'
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog 'No Mods are implemented...' 'Yellow'
|
||||
}
|
||||
}
|
||||
if ($DeletedMods -gt 0) {
|
||||
if ($DeletedMods -gt 0)
|
||||
{
|
||||
Write-ToLog "$DeletedMods Mods deleted (not externally managed) from local path: $($WAUConfig.InstallLocation.TrimEnd(' ', '\'))\mods" 'Red'
|
||||
}
|
||||
}
|
||||
|
||||
#Test if _WAU-mods.ps1 exist: Mods for WAU (if Network is active/any Winget is installed/running as SYSTEM)
|
||||
$Mods = "$WorkingDir\mods"
|
||||
if (Test-Path -Path "$Mods\_WAU-mods.ps1") {
|
||||
if (Test-Path -Path "$Mods\_WAU-mods.ps1")
|
||||
{
|
||||
Write-ToLog 'Running Mods for WAU...' 'Yellow'
|
||||
& "$Mods\_WAU-mods.ps1"
|
||||
$ModsExitCode = $LASTEXITCODE
|
||||
#If _WAU-mods.ps1 has ExitCode 1 - Re-run WAU
|
||||
if ($ModsExitCode -eq 1) {
|
||||
if ($ModsExitCode -eq 1)
|
||||
{
|
||||
Write-ToLog 'Re-run WAU'
|
||||
Start-Process -FilePath powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"$WorkingDir\winget-upgrade.ps1`""
|
||||
Exit
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($($WAUConfig.WAU_ListPath) -eq 'GPO') {
|
||||
if ($($WAUConfig.WAU_ListPath) -eq 'GPO')
|
||||
{
|
||||
$Script:GPOList = $True
|
||||
}
|
||||
|
||||
#Get White or Black list
|
||||
if ($WAUConfig.WAU_UseWhiteList -eq 1) {
|
||||
if ($WAUConfig.WAU_UseWhiteList -eq 1)
|
||||
{
|
||||
Write-ToLog 'WAU uses White List config'
|
||||
$toUpdate = Get-IncludedApps
|
||||
$UseWhiteList = $true
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog 'WAU uses Black List config'
|
||||
$toSkip = Get-ExcludedApps
|
||||
}
|
||||
|
||||
#Fix and count the array if GPO List as ERROR handling!
|
||||
if ($GPOList) {
|
||||
if ($UseWhiteList) {
|
||||
if ($GPOList)
|
||||
{
|
||||
if ($UseWhiteList)
|
||||
{
|
||||
$WhiteList = $toUpdate.GetUpperBound(0)
|
||||
if ($null -eq $WhiteList) {
|
||||
if ($null -eq $WhiteList)
|
||||
{
|
||||
Write-ToLog "Critical: Whitelist doesn't exist in GPO, exiting..." 'Red'
|
||||
New-Item -Path "$WorkingDir\logs\error.txt" -Value "Whitelist doesn't exist in GPO" -Force
|
||||
Exit 1
|
||||
exit 1
|
||||
}
|
||||
$toUpdate = $toUpdate.Data
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$BlackList = $toSkip.GetUpperBound(0)
|
||||
if ($null -eq $BlackList) {
|
||||
if ($null -eq $BlackList)
|
||||
{
|
||||
Write-ToLog "Critical: Blacklist doesn't exist in GPO, exiting..." 'Red'
|
||||
New-Item -Path "$WorkingDir\logs\error.txt" -Value "Blacklist doesn't exist in GPO" -Force
|
||||
Exit 1
|
||||
exit 1
|
||||
}
|
||||
$toSkip = $toSkip.Data
|
||||
}
|
||||
|
@ -236,15 +288,18 @@ if (Test-Network) {
|
|||
$outdated = Get-WingetOutdatedApps
|
||||
|
||||
#If something unusual happened
|
||||
if ($outdated -like 'An unusual*') {
|
||||
if ($outdated -like 'An unusual*')
|
||||
{
|
||||
Write-ToLog "$outdated" 'cyan'
|
||||
$outdated = $False
|
||||
}
|
||||
|
||||
#Run only if $outdated is populated!
|
||||
if ($outdated) {
|
||||
if ($outdated)
|
||||
{
|
||||
#Log list of app to update
|
||||
foreach ($app in $outdated) {
|
||||
foreach ($app in $outdated)
|
||||
{
|
||||
#List available updates
|
||||
$Log = "-> Available update : $($app.Name). Current version : $($app.Version). Available version : $($app.AvailableVersion)."
|
||||
$Log | Write-host
|
||||
|
@ -255,67 +310,84 @@ if (Test-Network) {
|
|||
$Script:InstallOK = 0
|
||||
|
||||
#Trick under user context when -BypassListForUsers is used
|
||||
if ($IsSystem -eq $false -and $WAUConfig.WAU_BypassListForUsers -eq 1) {
|
||||
if ($IsSystem -eq $false -and $WAUConfig.WAU_BypassListForUsers -eq 1)
|
||||
{
|
||||
Write-ToLog 'Bypass system list in user context is Enabled.'
|
||||
$UseWhiteList = $false
|
||||
$toSkip = $null
|
||||
}
|
||||
|
||||
#If White List
|
||||
if ($UseWhiteList) {
|
||||
if ($UseWhiteList)
|
||||
{
|
||||
#For each app, notify and update
|
||||
foreach ($app in $outdated) {
|
||||
if (($toUpdate -contains $app.Id) -and $($app.Version) -ne 'Unknown') {
|
||||
foreach ($app in $outdated)
|
||||
{
|
||||
if (($toUpdate -contains $app.Id) -and $($app.Version) -ne 'Unknown')
|
||||
{
|
||||
Update-App $app
|
||||
}
|
||||
#if current app version is unknown
|
||||
elseif ($($app.Version) -eq 'Unknown') {
|
||||
elseif ($($app.Version) -eq 'Unknown')
|
||||
{
|
||||
Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" 'Gray'
|
||||
}
|
||||
#if app is in "excluded list"
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog "$($app.Name) : Skipped upgrade because it is not in the included app list" 'Gray'
|
||||
}
|
||||
}
|
||||
}
|
||||
#If Black List or default
|
||||
else {
|
||||
else
|
||||
{
|
||||
#For each app, notify and update
|
||||
foreach ($app in $outdated) {
|
||||
if (-not ($toSkip -contains $app.Id) -and $($app.Version) -ne 'Unknown') {
|
||||
foreach ($app in $outdated)
|
||||
{
|
||||
if (-not ($toSkip -contains $app.Id) -and $($app.Version) -ne 'Unknown')
|
||||
{
|
||||
Update-App $app
|
||||
}
|
||||
#if current app version is unknown
|
||||
elseif ($($app.Version) -eq 'Unknown') {
|
||||
elseif ($($app.Version) -eq 'Unknown')
|
||||
{
|
||||
Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" 'Gray'
|
||||
}
|
||||
#if app is in "excluded list"
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog "$($app.Name) : Skipped upgrade because it is in the excluded app list" 'Gray'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($InstallOK -gt 0) {
|
||||
if ($InstallOK -gt 0)
|
||||
{
|
||||
Write-ToLog "$InstallOK apps updated ! No more update." 'Green'
|
||||
}
|
||||
}
|
||||
|
||||
if ($InstallOK -eq 0 -or !$InstallOK) {
|
||||
if ($InstallOK -eq 0 -or !$InstallOK)
|
||||
{
|
||||
Write-ToLog 'No new update.' 'Green'
|
||||
}
|
||||
|
||||
#Check if any user is logged on if System and run User task (if installed)
|
||||
if ($IsSystem) {
|
||||
if ($IsSystem)
|
||||
{
|
||||
#User check routine from: https://stackoverflow.com/questions/23219718/powershell-script-to-see-currently-logged-in-users-domain-and-machine-status
|
||||
$explorerprocesses = @(Get-WmiObject -Query "Select * FROM Win32_Process WHERE Name='explorer.exe'" -ErrorAction SilentlyContinue)
|
||||
If ($explorerprocesses.Count -eq 0) {
|
||||
if ($explorerprocesses.Count -eq 0)
|
||||
{
|
||||
Write-ToLog 'No explorer process found / Nobody interactively logged on...'
|
||||
}
|
||||
Else {
|
||||
else
|
||||
{
|
||||
#Run WAU in user context if the user task exist
|
||||
$UserScheduledTask = Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -ErrorAction SilentlyContinue
|
||||
if ($UserScheduledTask) {
|
||||
if ($UserScheduledTask)
|
||||
{
|
||||
|
||||
#Get Winget system apps to excape them befor running user context
|
||||
Write-ToLog 'User logged on, get a list of installed Winget apps in System context...'
|
||||
|
@ -324,19 +396,21 @@ if (Test-Network) {
|
|||
#Run user context scheduled task
|
||||
Write-ToLog 'Starting WAU in User context'
|
||||
Start-ScheduledTask -TaskName $UserScheduledTask.TaskName -ErrorAction SilentlyContinue
|
||||
Exit 0
|
||||
exit 0
|
||||
}
|
||||
elseif (!$UserScheduledTask) {
|
||||
elseif (!$UserScheduledTask)
|
||||
{
|
||||
Write-ToLog 'User context execution not installed...'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Write-ToLog 'Critical: Winget not installed or detected, exiting...' 'red'
|
||||
New-Item -Path "$WorkingDir\logs\error.txt" -Value 'Winget not installed or detected' -Force
|
||||
Write-ToLog 'End of process!' 'Cyan'
|
||||
Exit 1
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@ function Add-ScopeMachine
|
|||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$SettingsPath
|
||||
[string]
|
||||
$SettingsPath
|
||||
)
|
||||
|
||||
if (Test-Path -Path $SettingsPath -ErrorAction SilentlyContinue)
|
||||
|
@ -16,7 +17,8 @@ function Add-ScopeMachine
|
|||
|
||||
if (!$ConfigFile)
|
||||
{
|
||||
$ConfigFile = @{}
|
||||
$ConfigFile = @{
|
||||
}
|
||||
}
|
||||
|
||||
if ($ConfigFile.installBehavior.preferences.scope)
|
||||
|
|
|
@ -4,11 +4,16 @@ function Add-Shortcut
|
|||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$Target,
|
||||
[string]$Shortcut,
|
||||
[string]$Arguments,
|
||||
[string]$Icon,
|
||||
[string]$Description
|
||||
[string]
|
||||
$Target,
|
||||
[string]
|
||||
$Shortcut,
|
||||
[string]
|
||||
$Arguments,
|
||||
[string]
|
||||
$Icon,
|
||||
[string]
|
||||
$Description
|
||||
)
|
||||
|
||||
$WScriptShell = (New-Object -ComObject WScript.Shell)
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
Function Confirm-Installation
|
||||
function Confirm-Installation
|
||||
{
|
||||
# Set json export file
|
||||
|
||||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$AppName,
|
||||
[string]$AppVer
|
||||
[string]
|
||||
$AppName,
|
||||
[string]
|
||||
$AppVer
|
||||
)
|
||||
|
||||
$JsonFile = ('{0}\Config\InstalledApps.json' -f $WorkingDir)
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# Function to get AZCopy, if it doesn't exist and update it, if it does
|
||||
|
||||
Function Get-AZCopy
|
||||
function Get-AZCopy
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$WingetUpdatePath
|
||||
[string]
|
||||
$WingetUpdatePath
|
||||
)
|
||||
|
||||
$AZCopyLink = (Invoke-WebRequest -Uri https://aka.ms/downloadazcopy-v10-windows -UseBasicParsing -MaximumRedirection 0 -ErrorAction SilentlyContinue).headers.location
|
||||
|
@ -29,7 +30,7 @@ Function Get-AZCopy
|
|||
$AZCopyCurrentVersion = '0.0.0'
|
||||
}
|
||||
|
||||
if (([version] $AZCopyCurrentVersion) -lt ([version] $AZCopyLatestVersion))
|
||||
if (([version]$AZCopyCurrentVersion) -lt ([version]$AZCopyLatestVersion))
|
||||
{
|
||||
Write-ToLog -LogMsg ('Installing version {0} of AZCopy' -f $AZCopyLatestVersion)
|
||||
$null = (Invoke-WebRequest -Uri $AZCopyLink -UseBasicParsing -OutFile ('{0}\azcopyv10.zip' -f $WingetUpdatePath))
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
# Get the winget App Information
|
||||
|
||||
Function Get-AppInfo
|
||||
function Get-AppInfo
|
||||
{
|
||||
# Get AppID Info
|
||||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$AppID
|
||||
[string]
|
||||
$AppID
|
||||
)
|
||||
|
||||
$String = (& $winget show $AppID --accept-source-agreements -s winget | Out-String)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#Function to get the locale file for notifications
|
||||
|
||||
Function Get-NotifLocale {
|
||||
function Get-NotifLocale
|
||||
{
|
||||
|
||||
# Get OS locale
|
||||
$OSLocale = (Get-UICulture).Parent
|
||||
|
@ -9,11 +10,13 @@ Function Get-NotifLocale {
|
|||
$TestOSLocalPath = ('{0}\locale\{1}.xml' -f $WorkingDir, $OSLocale.Name)
|
||||
|
||||
# Set OS Local if file exists
|
||||
if (Test-Path -Path $TestOSLocalPath -ErrorAction SilentlyContinue) {
|
||||
if (Test-Path -Path $TestOSLocalPath -ErrorAction SilentlyContinue)
|
||||
{
|
||||
$LocaleDisplayName = $OSLocale.DisplayName
|
||||
$LocaleFile = $TestOSLocalPath
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
# Set English if file doesn't exist
|
||||
$LocaleDisplayName = 'English'
|
||||
$LocaleFile = ('{0}\locale\en.xml' -f $WorkingDir)
|
||||
|
@ -23,6 +26,6 @@ Function Get-NotifLocale {
|
|||
[xml]$Script:NotifLocale = (Get-Content -Path $LocaleFile -Encoding UTF8 -ErrorAction SilentlyContinue)
|
||||
|
||||
# Rerturn langague display name
|
||||
Return $LocaleDisplayName
|
||||
return $LocaleDisplayName
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Function to get the Domain/Local Policies (GPO)
|
||||
|
||||
Function Get-Policies
|
||||
function Get-Policies
|
||||
{
|
||||
# Get WAU Policies and set the Configurations Registry Accordingly
|
||||
$WAUPolicies = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate' -ErrorAction SilentlyContinue)
|
||||
|
@ -196,7 +196,8 @@ Function Get-Policies
|
|||
$task = $folder.GetTask('Winget-AutoUpdate')
|
||||
$definition = $task.Definition
|
||||
$null = $definition.Triggers.Count
|
||||
switch ($($WAUPolicies.WAU_UpdatesInterval)) {
|
||||
switch ($($WAUPolicies.WAU_UpdatesInterval))
|
||||
{
|
||||
'Daily'
|
||||
{
|
||||
$tasktrigger = New-ScheduledTaskTrigger -Daily -At $($WAUConfig.WAU_UpdatesAtTime)
|
||||
|
@ -466,5 +467,5 @@ Function Get-Policies
|
|||
}
|
||||
}
|
||||
|
||||
Return $($WAUPolicies.WAU_ActivateGPOManagement), $ChangedSettings
|
||||
return $($WAUPolicies.WAU_ActivateGPOManagement), $ChangedSettings
|
||||
}
|
||||
|
|
|
@ -1,31 +1,41 @@
|
|||
# Function to get the winget command regarding execution context (User, System...)
|
||||
|
||||
Function Get-WingetCmd {
|
||||
function Get-WingetCmd
|
||||
{
|
||||
|
||||
# Get WinGet Path (if Admin context)
|
||||
# Includes Workaround for ARM64 (removed X64 and replaces it with a wildcard)
|
||||
$ResolveWingetPath = (Resolve-Path -Path "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_*__8wekyb3d8bbwe" | Sort-Object -Property { [version]($_.Path -replace '^[^\d]+_((\d+\.)*\d+)_.*', '$1') })
|
||||
$ResolveWingetPath = (Resolve-Path -Path "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_*__8wekyb3d8bbwe" | Sort-Object -Property {
|
||||
[version]($_.Path -replace '^[^\d]+_((\d+\.)*\d+)_.*', '$1')
|
||||
})
|
||||
|
||||
if ($ResolveWingetPath) {
|
||||
if ($ResolveWingetPath)
|
||||
{
|
||||
# If multiple version, pick last one
|
||||
$WingetPath = $ResolveWingetPath[-1].Path
|
||||
}
|
||||
|
||||
#If running under System or Admin context obtain Winget from Program Files
|
||||
if((([Security.Principal.WindowsIdentity]::GetCurrent().User) -eq 'S-1-5-18') -or ($WingetPath)){
|
||||
if (Test-Path -Path ('{0}\winget.exe' -f $WingetPath) -ErrorAction SilentlyContinue) {
|
||||
if ((([Security.Principal.WindowsIdentity]::GetCurrent().User) -eq 'S-1-5-18') -or ($WingetPath))
|
||||
{
|
||||
if (Test-Path -Path ('{0}\winget.exe' -f $WingetPath) -ErrorAction SilentlyContinue)
|
||||
{
|
||||
$Script:Winget = ('{0}\winget.exe' -f $WingetPath)
|
||||
}
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
#Get Winget Location in User context
|
||||
$WingetCmd = (Get-Command -Name winget.exe -ErrorAction SilentlyContinue)
|
||||
|
||||
if ($WingetCmd) {
|
||||
if ($WingetCmd)
|
||||
{
|
||||
$Script:Winget = $WingetCmd.Source
|
||||
}
|
||||
}
|
||||
|
||||
If(!($Script:Winget)){
|
||||
if (!($Script:Winget))
|
||||
{
|
||||
Write-ToLog 'Winget not installed or detected !' 'Red'
|
||||
|
||||
return $false
|
||||
|
|
|
@ -44,7 +44,7 @@ function Get-WingetOutdatedApps
|
|||
# Now cycle in real package and split accordingly
|
||||
$upgradeList = @()
|
||||
|
||||
For ($i = $fl + 2; $i -lt $lines.Length; $i++)
|
||||
for ($i = $fl + 2; $i -lt $lines.Length; $i++)
|
||||
{
|
||||
$line = $lines[$i] -replace '[\u2026]', ' ' #Fix "..." in long names
|
||||
|
||||
|
|
|
@ -15,9 +15,12 @@ function Invoke-LogRotation
|
|||
#>
|
||||
param
|
||||
(
|
||||
[string]$LogFile,
|
||||
[int]$MaxLogFiles,
|
||||
[int]$MaxLogSize
|
||||
[string]
|
||||
$LogFile,
|
||||
[int]
|
||||
$MaxLogFiles,
|
||||
[int]
|
||||
$MaxLogSize
|
||||
)
|
||||
|
||||
try
|
||||
|
@ -32,7 +35,7 @@ function Invoke-LogRotation
|
|||
$logFileNameExtension = [IO.Path]::GetExtension($logFileName)
|
||||
|
||||
# if MaxLogFiles is 1 just keep the original one and let it grow
|
||||
if (-not($MaxLogFiles -eq 1))
|
||||
if (-not ($MaxLogFiles -eq 1))
|
||||
{
|
||||
if ($currentSize -ge $MaxLogSize)
|
||||
{
|
||||
|
@ -59,11 +62,11 @@ function Invoke-LogRotation
|
|||
}
|
||||
catch
|
||||
{
|
||||
Return $False
|
||||
return $False
|
||||
}
|
||||
|
||||
# if MaxLogFiles is 0 don't delete any old archived log files
|
||||
if (-not($MaxLogFiles -eq 0))
|
||||
if (-not ($MaxLogFiles -eq 0))
|
||||
{
|
||||
# set filter to search for archived log files
|
||||
$archivedLogFileFilter = $logFileNameWithoutExtension + '??????????????' + $logFileNameExtension
|
||||
|
@ -104,12 +107,12 @@ function Invoke-LogRotation
|
|||
|
||||
Write-ToLog -LogMsg ('Max Log Size reached: {0} bytes - Rotated Logs' -f $MaxLogSize)
|
||||
|
||||
Return $True
|
||||
return $True
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Return $False
|
||||
return $False
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ function Invoke-ModsProtect
|
|||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$ModsPath
|
||||
[string]
|
||||
$ModsPath
|
||||
)
|
||||
|
||||
try
|
||||
|
|
|
@ -69,11 +69,11 @@ function Invoke-PostUpdateActions
|
|||
}
|
||||
|
||||
# Current: v1.5.2201 = 1.20.2201.0 = 2023.808.2243.0
|
||||
If ([Version]$TestWinGet.Version -ge '2023.808.2243.0')
|
||||
if ([Version]$TestWinGet.Version -ge '2023.808.2243.0')
|
||||
{
|
||||
Write-ToLog -LogMsg '-> WinGet is Installed/up to date' -LogColor 'green'
|
||||
}
|
||||
Else
|
||||
else
|
||||
{
|
||||
# Download WinGet MSIXBundle
|
||||
Write-ToLog -LogMsg '-> Not installed/up to date. Downloading WinGet...'
|
||||
|
|
|
@ -3,17 +3,27 @@
|
|||
function Start-NotifTask
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[String]$Title = 'Winget-AutoUpdate',
|
||||
[String]$Message,
|
||||
[String]$MessageType,
|
||||
[String]$Balise = 'WAU',
|
||||
[String]$OnClickAction,
|
||||
[String]$Body,
|
||||
[String]$Button1Text,
|
||||
[String]$Button1Action,
|
||||
[Switch]$ButtonDismiss = $false,
|
||||
[Switch]$UserRun = $false
|
||||
param (
|
||||
[String]
|
||||
$Title = 'Winget-AutoUpdate',
|
||||
[String]
|
||||
$Message,
|
||||
[String]
|
||||
$MessageType,
|
||||
[String]
|
||||
$Balise = 'WAU',
|
||||
[String]
|
||||
$OnClickAction,
|
||||
[String]
|
||||
$Body,
|
||||
[String]
|
||||
$Button1Text,
|
||||
[String]
|
||||
$Button1Action,
|
||||
[Switch]
|
||||
$ButtonDismiss = $false,
|
||||
[Switch]
|
||||
$UserRun = $false
|
||||
)
|
||||
|
||||
if (($WAUConfig.WAU_NotificationLevel -eq 'Full') -or ($WAUConfig.WAU_NotificationLevel -eq 'SuccessOnly' -and $MessageType -eq 'Success') -or ($UserRun))
|
||||
|
|
|
@ -6,9 +6,12 @@ function Test-ListPath
|
|||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$ListPath,
|
||||
[string]$UseWhiteList,
|
||||
[string]$WingetUpdatePath
|
||||
[string]
|
||||
$ListPath,
|
||||
[string]
|
||||
$UseWhiteList,
|
||||
[string]
|
||||
$WingetUpdatePath
|
||||
)
|
||||
|
||||
if ($UseWhiteList)
|
||||
|
|
|
@ -6,7 +6,8 @@ function Test-Mods
|
|||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$app
|
||||
[string]
|
||||
$app
|
||||
)
|
||||
|
||||
$ModsPreInstall = $null
|
||||
|
|
|
@ -8,9 +8,12 @@ function Test-ModsPath
|
|||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$ModsPath,
|
||||
[string]$WingetUpdatePath,
|
||||
[string]$AzureBlobSASURL
|
||||
[string]
|
||||
$ModsPath,
|
||||
[string]
|
||||
$WingetUpdatePath,
|
||||
[string]
|
||||
$AzureBlobSASURL
|
||||
)
|
||||
$LocalMods = -join ($WingetUpdatePath, '\', 'mods')
|
||||
$ExternalMods = $ModsPath
|
||||
|
@ -64,7 +67,7 @@ function Test-ModsPath
|
|||
|
||||
foreach ($Bin in $InternalBinsNames)
|
||||
{
|
||||
If ($CleanLinks -notcontains $Bin)
|
||||
if ($CleanLinks -notcontains $Bin)
|
||||
{
|
||||
$null = (Remove-Item -Path $LocalMods\bins\$Bin -Force -Confirm:$False -ErrorAction SilentlyContinue)
|
||||
}
|
||||
|
@ -122,7 +125,7 @@ function Test-ModsPath
|
|||
|
||||
foreach ($Mod in $InternalModsNames)
|
||||
{
|
||||
If ($CleanLinks -notcontains $Mod)
|
||||
if ($CleanLinks -notcontains $Mod)
|
||||
{
|
||||
$null = (Remove-Item -Path $LocalMods\$Mod -Force -Confirm:$False -ErrorAction SilentlyContinue)
|
||||
$DeletedMods++
|
||||
|
@ -191,14 +194,14 @@ function Test-ModsPath
|
|||
$AZCopySyncOutput = & $WingetUpdatePath\azcopy.exe sync $AzureBlobSASURL $LocalMods --from-to BlobLocal --delete-destination=true
|
||||
$AZCopyOutputLines = $AZCopySyncOutput.Split([Environment]::NewLine)
|
||||
|
||||
foreach ( $_ in $AZCopyOutputLines)
|
||||
foreach ($_ in $AZCopyOutputLines)
|
||||
{
|
||||
$AZCopySyncAdditionsRegex = [regex]::new('(?<=Number of Copy Transfers Completed:\s+)\d+')
|
||||
$AZCopySyncDeletionsRegex = [regex]::new('(?<=Number of Deletions at Destination:\s+)\d+')
|
||||
$AZCopySyncErrorRegex = [regex]::new('^Cannot perform sync due to error:')
|
||||
|
||||
$AZCopyAdditions = [int] $AZCopySyncAdditionsRegex.Match($_).Value
|
||||
$AZCopyDeletions = [int] $AZCopySyncDeletionsRegex.Match($_).Value
|
||||
$AZCopyAdditions = [int]$AZCopySyncAdditionsRegex.Match($_).Value
|
||||
$AZCopyDeletions = [int]$AZCopySyncDeletionsRegex.Match($_).Value
|
||||
|
||||
if ($AZCopyAdditions -ne 0)
|
||||
{
|
||||
|
@ -235,7 +238,7 @@ function Test-ModsPath
|
|||
# Delete Local Bins that don't exist Externally
|
||||
foreach ($Bin in $InternalBinsNames)
|
||||
{
|
||||
If ($Bin -notin $ExternalBinsNames )
|
||||
if ($Bin -notin $ExternalBinsNames)
|
||||
{
|
||||
$null = (Remove-Item -Path $LocalMods\bins\$Bin -Force -Confirm:$False -ErrorAction SilentlyContinue)
|
||||
}
|
||||
|
@ -271,7 +274,7 @@ function Test-ModsPath
|
|||
|
||||
foreach ($Mod in $InternalModsNames)
|
||||
{
|
||||
If ($Mod -notin $ExternalModsNames )
|
||||
if ($Mod -notin $ExternalModsNames)
|
||||
{
|
||||
$null = Remove-Item -Path $LocalMods\$Mod -Force -ErrorAction SilentlyContinue
|
||||
$DeletedMods++
|
||||
|
|
|
@ -8,7 +8,7 @@ function Test-Network
|
|||
|
||||
# Test connectivity during 30 min then timeout
|
||||
Write-ToLog -LogMsg 'Checking internet connection...' -LogColor 'Yellow'
|
||||
While ($timeout -lt 1800)
|
||||
while ($timeout -lt 1800)
|
||||
{
|
||||
$URLtoTest = 'https://raw.githubusercontent.com/Romanitho/Winget-AutoUpdate/main/LICENSE'
|
||||
$URLcontent = ((Invoke-WebRequest -Uri $URLtoTest -UseBasicParsing).content)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Function to update an App
|
||||
|
||||
Function Update-App
|
||||
function Update-App
|
||||
{
|
||||
# Get App Info
|
||||
[CmdletBinding()]
|
||||
|
|
|
@ -6,8 +6,10 @@ function Write-ToLog
|
|||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
[string]$LogMsg,
|
||||
[string]$LogColor = 'White'
|
||||
[string]
|
||||
$LogMsg,
|
||||
[string]
|
||||
$LogColor = 'White'
|
||||
)
|
||||
|
||||
$Log = ('{0} - {1}' -f (Get-Date -UFormat '%T'), $LogMsg)
|
||||
|
|
Loading…
Reference in New Issue