adjustments

pull/431/head
romanitho 2023-10-17 22:13:54 +02:00
parent b1ada1991d
commit b48e8f894e
2 changed files with 24 additions and 20 deletions

View File

@ -128,7 +128,7 @@ param(
function Install-Prerequisites { function Install-Prerequisites {
Write-ToLog "`nChecking prerequisites..." "Yellow" Write-ToLog "Checking prerequisites..." "Yellow"
#Check if Visual C++ 2019 or 2022 installed #Check if Visual C++ 2019 or 2022 installed
$Visual2019 = "Microsoft Visual C++ 2015-2019 Redistributable*" $Visual2019 = "Microsoft Visual C++ 2015-2019 Redistributable*"
@ -171,25 +171,25 @@ function Install-Prerequisites {
Write-ToLog "-> Installing VC_redist.$OSArch.exe..." Write-ToLog "-> Installing VC_redist.$OSArch.exe..."
Start-Process -FilePath $Installer -Args "/quiet /norestart" -Wait Start-Process -FilePath $Installer -Args "/quiet /norestart" -Wait
Remove-Item $Installer -ErrorAction Ignore Remove-Item $Installer -ErrorAction Ignore
Write-ToLog "-> MS Visual C++ 2015-2022 installed successfully" "Green" Write-ToLog "-> MS Visual C++ 2015-2022 installed successfully`n" "Green"
} }
catch { catch {
Write-ToLog "-> MS Visual C++ 2015-2022 installation failed." "Red" Write-ToLog "-> MS Visual C++ 2015-2022 installation failed.`n" "Red"
Start-Sleep 3 Start-Sleep 3
} }
} }
else { else {
Write-ToLog "-> MS Visual C++ 2015-2022 will not be installed." "Magenta" Write-ToLog "-> MS Visual C++ 2015-2022 will not be installed.`n" "Magenta"
} }
} }
else { else {
Write-ToLog "-> Prerequisites checked. OK" "Green" Write-ToLog "-> Prerequisites checked. OK`n" "Green"
} }
} }
function Install-WinGet { function Install-WinGet {
Write-ToLog "`nChecking if WinGet is installed/up to date" "Yellow" Write-ToLog "Checking if WinGet is installed/up to date" "Yellow"
#Check available WinGet version, if fail set version to the latest version as of 2023-10-08 #Check available WinGet version, if fail set version to the latest version as of 2023-10-08
$WinGetAvailableVersion = Get-WinGetAvailableVersion $WinGetAvailableVersion = Get-WinGetAvailableVersion
@ -607,21 +607,21 @@ $Script:ProgressPreference = 'SilentlyContinue'
#Set install log file #Set install log file
$Script:LogFile = "$WingetUpdatePath\logs\WAU-Installer.log" $Script:LogFile = "$WingetUpdatePath\logs\WAU-Installer.log"
Write-ToLog "`n" Write-Host "`n"
Write-ToLog "`t 888 888 d8888 888 888" "Magenta" Write-Host "`t 888 888 d8888 888 888" -ForegroundColor Magenta
Write-ToLog "`t 888 o 888 d88888 888 888" "Magenta" Write-Host "`t 888 o 888 d88888 888 888" -ForegroundColor Magenta
Write-ToLog "`t 888 d8b 888 d88P888 888 888" "Magenta" Write-Host "`t 888 d8b 888 d88P888 888 888" -ForegroundColor Magenta
Write-ToLog "`t 888 d888b 888 d88P 888 888 888" "Magenta" Write-Host "`t 888 d888b 888 d88P 888 888 888" -ForegroundColor Magenta
Write-ToLog "`t 888d88888b888 d88P 888 888 888" "Magenta" Write-Host "`t 888d88888b888 d88P 888 888 888" -ForegroundColor Magenta
Write-ToLog "`t 88888P Y88888 d88P 888 888 888" "Cyan" Write-Host "`t 88888P Y88888 d88P 888 888 888" -ForegroundColor Cyan
Write-ToLog "`t 8888P Y8888 d88P 888 888 888" "Magenta" Write-Host "`t 8888P Y8888 d88P 888 888 888" -ForegroundColor Magenta
Write-ToLog "`t 888P Y888 d88P 888 Y8888888P`n" "Magenta" Write-Host "`t 888P Y888 d88P 888 Y8888888P`n" -ForegroundColor Magenta
Write-ToLog "`t Winget-AutoUpdate $WAUVersion`n" "Cyan" Write-Host "`t Winget-AutoUpdate $WAUVersion`n" -ForegroundColor Cyan
Write-ToLog "`t https://github.com/Romanitho/Winget-AutoUpdate`n" "Magenta" Write-Host "`t https://github.com/Romanitho/Winget-AutoUpdate`n" -ForegroundColor Magenta
Write-ToLog "`t________________________________________________________`n`n" Write-Host "`t________________________________________________________`n`n"
if (!$Uninstall) { if (!$Uninstall) {
Write-ToLog "Installing WAU to $WingetUpdatePath\" Write-ToLog "Installing WAU to $WingetUpdatePath\`n"
Install-Prerequisites Install-Prerequisites
Install-WinGet Install-WinGet
Install-WingetAutoUpdate Install-WingetAutoUpdate
@ -635,5 +635,5 @@ if (Test-Path "$WingetUpdatePath\Version.txt") {
Remove-Item "$WingetUpdatePath\Version.txt" -Force Remove-Item "$WingetUpdatePath\Version.txt" -Force
} }
Write-ToLog "`nEnd of process." "Cyan" Write-ToLog "End of process." "Cyan"
Start-Sleep 3 Start-Sleep 3

View File

@ -8,6 +8,10 @@ Get-ChildItem "$WorkingDir\functions" | ForEach-Object { . $_.FullName }
<# MAIN #> <# MAIN #>
#Config console output encoding
$null = cmd /c ''
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
#Check if running account is system or interactive logon #Check if running account is system or interactive logon
$Script:IsSystem = [System.Security.Principal.WindowsIdentity]::GetCurrent().IsSystem $Script:IsSystem = [System.Security.Principal.WindowsIdentity]::GetCurrent().IsSystem