CMTrace visibility

pull/434/head
romanitho 2023-10-19 14:39:33 +02:00
parent 5fae7c7f65
commit 0d7b11a4e5
3 changed files with 18 additions and 18 deletions

View File

@ -171,19 +171,19 @@ 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`n" "Green" Write-ToLog "-> MS Visual C++ 2015-2022 installed successfully`n " "Green"
} }
catch { catch {
Write-ToLog "-> MS Visual C++ 2015-2022 installation failed.`n" "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.`n" "Magenta" Write-ToLog "-> MS Visual C++ 2015-2022 will not be installed.`n " "Magenta"
} }
} }
else { else {
Write-ToLog "-> Prerequisites checked. OK`n" "Green" Write-ToLog "-> Prerequisites checked. OK`n " "Green"
} }
} }
@ -262,7 +262,7 @@ function Install-WinGet {
Update-StoreApps Update-StoreApps
} }
else { else {
Write-ToLog "-> WinGet is up to date: v$WinGetInstalledVersion`n" "Green" Write-ToLog "-> WinGet is up to date: v$WinGetInstalledVersion`n " "Green"
} }
} }
@ -455,13 +455,13 @@ function Install-WingetAutoUpdate {
Write-ToLog "Checking Mods Directory:" "Yellow" Write-ToLog "Checking Mods Directory:" "Yellow"
$Protected = Invoke-ModsProtect "$WingetUpdatePath\mods" $Protected = Invoke-ModsProtect "$WingetUpdatePath\mods"
if ($Protected -eq $True) { if ($Protected -eq $True) {
Write-ToLog "-> The mods directory is now secured!`n" "Green" Write-ToLog "-> The mods directory is now secured!`n " "Green"
} }
elseif ($Protected -eq $False) { elseif ($Protected -eq $False) {
Write-ToLog "-> The mods directory was already secured!`n" "Green" Write-ToLog "-> The mods directory was already secured!`n " "Green"
} }
else { else {
Write-ToLog "-> Error: The mods directory couldn't be verified as secured!`n" "Red" Write-ToLog "-> Error: The mods directory couldn't be verified as secured!`n " "Red"
} }
#Create Shortcuts #Create Shortcuts
@ -530,15 +530,15 @@ function Uninstall-WingetAutoUpdate {
Remove-Item -Path "${env:Public}\Desktop\WAU - Check for updated Apps.lnk" -Force | Out-Null Remove-Item -Path "${env:Public}\Desktop\WAU - Check for updated Apps.lnk" -Force | Out-Null
} }
Write-ToLog "Uninstallation succeeded!`n" "Green" Write-ToLog "Uninstallation succeeded!`n " "Green"
Start-sleep 1 Start-sleep 1
} }
else { else {
Write-ToLog "$InstallLocation not found! Uninstallation failed!`n" "Red" Write-ToLog "$InstallLocation not found! Uninstallation failed!`n " "Red"
} }
} }
catch { catch {
Write-ToLog "Uninstallation failed! Run as admin ?`n" "Red" Write-ToLog "Uninstallation failed! Run as admin ?`n " "Red"
Start-sleep 1 Start-sleep 1
} }
} }
@ -607,7 +607,7 @@ $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-Host "`n" Write-Host "`n "
Write-Host "`t 888 888 d8888 888 888" -ForegroundColor Magenta Write-Host "`t 888 888 d8888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 o 888 d88888 888 888" -ForegroundColor Magenta Write-Host "`t 888 o 888 d88888 888 888" -ForegroundColor Magenta
Write-Host "`t 888 d8b 888 d88P888 888 888" -ForegroundColor Magenta Write-Host "`t 888 d8b 888 d88P888 888 888" -ForegroundColor Magenta
@ -615,10 +615,10 @@ Write-Host "`t 888 d888b 888 d88P 888 888 888" -ForegroundColor
Write-Host "`t 888d88888b888 d88P 888 888 888" -ForegroundColor Magenta Write-Host "`t 888d88888b888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 88888P Y88888 d88P 888 888 888" -ForegroundColor Cyan Write-Host "`t 88888P Y88888 d88P 888 888 888" -ForegroundColor Cyan
Write-Host "`t 8888P Y8888 d88P 888 888 888" -ForegroundColor Magenta Write-Host "`t 8888P Y8888 d88P 888 888 888" -ForegroundColor Magenta
Write-Host "`t 888P Y888 d88P 888 Y8888888P`n" -ForegroundColor Magenta Write-Host "`t 888P Y888 d88P 888 Y8888888P`n " -ForegroundColor Magenta
Write-Host "`t Winget-AutoUpdate $WAUVersion`n" -ForegroundColor Cyan Write-Host "`t Winget-AutoUpdate $WAUVersion`n " -ForegroundColor Cyan
Write-Host "`t https://github.com/Romanitho/Winget-AutoUpdate`n" -ForegroundColor Magenta Write-Host "`t https://github.com/Romanitho/Winget-AutoUpdate`n " -ForegroundColor Magenta
Write-Host "`t________________________________________________________`n`n" Write-Host "`t________________________________________________________`n `n "
if (!$Uninstall) { if (!$Uninstall) {
Write-ToLog "Installing WAU to $WingetUpdatePath\" Write-ToLog "Installing WAU to $WingetUpdatePath\"

View File

@ -351,7 +351,7 @@ if (Test-Network) {
#Adds SymLink if Intune managed #Adds SymLink if Intune managed
$IntuneLogPath = "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs" $IntuneLogPath = "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs"
if ((Test-Path "$IntuneLogPath") -and !(Test-Path "$IntuneLogPath\WAU-updates.log")) { if ((Test-Path "$IntuneLogPath") -and !(Test-Path "$IntuneLogPath\WAU-updates.log")) {
Write-ToLog "`nCreating SymLink for log file (WAU-updates) in Intune Management Extension log folder" "Yellow" Write-ToLog " `nCreating SymLink for log file (WAU-updates) in Intune Management Extension log folder" "Yellow"
New-Item -Path "$IntuneLogPath\WAU-updates.log" -ItemType SymbolicLink -Value $LogFile -Force -ErrorAction SilentlyContinue | Out-Null New-Item -Path "$IntuneLogPath\WAU-updates.log" -ItemType SymbolicLink -Value $LogFile -Force -ErrorAction SilentlyContinue | Out-Null
} }

View File

@ -26,7 +26,7 @@ function Write-ToLog {
#If header requested #If header requested
if ($IsHeader) { if ($IsHeader) {
$Log = "`n##################################################`n# $LogMsg - $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern)`n##################################################" $Log = " `n##################################################`n# $LogMsg - $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern)`n##################################################"
} }
else { else {
$Log = "$(Get-Date -UFormat "%T") - $LogMsg" $Log = "$(Get-Date -UFormat "%T") - $LogMsg"