diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index f903c34..2e736b8 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -171,19 +171,19 @@ function Install-Prerequisites { Write-ToLog "-> Installing VC_redist.$OSArch.exe..." Start-Process -FilePath $Installer -Args "/quiet /norestart" -Wait 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 { - 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 } } 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 { - Write-ToLog "-> Prerequisites checked. OK`n " "Green" + Write-ToLog "-> Prerequisites checked. OK`n" "Green" } } @@ -262,7 +262,7 @@ function Install-WinGet { Update-StoreApps } 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" $Protected = Invoke-ModsProtect "$WingetUpdatePath\mods" 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) { - Write-ToLog "-> The mods directory was already secured!`n " "Green" + Write-ToLog "-> The mods directory was already secured!`n" "Green" } 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 @@ -530,15 +530,15 @@ function Uninstall-WingetAutoUpdate { 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 } else { - Write-ToLog "$InstallLocation not found! Uninstallation failed!`n " "Red" + Write-ToLog "$InstallLocation not found! Uninstallation failed!`n" "Red" } } catch { - Write-ToLog "Uninstallation failed! Run as admin ?`n " "Red" + Write-ToLog "Uninstallation failed! Run as admin ?`n" "Red" Start-sleep 1 } } diff --git a/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Winget-AutoUpdate/Winget-Upgrade.ps1 index 7c21a32..e904e4d 100644 --- a/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -304,6 +304,13 @@ if (Test-Network) { #Check if user context is activated during system run if ($IsSystem) { + #Adds SymLink if Intune managed + $IntuneLogPath = "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs" + if ((Test-Path "$IntuneLogPath") -and !(Test-Path "$IntuneLogPath\WAU-updates.log")) { + Write-ToLog "Creating 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 + } + #Run WAU in user context if feature is activated if ($WAUConfig.WAU_UserContext -eq 1) { @@ -348,13 +355,6 @@ if (Test-Network) { } } -#Adds SymLink if Intune managed -$IntuneLogPath = "${env:ProgramData}\Microsoft\IntuneManagementExtension\Logs" -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" - New-Item -Path "$IntuneLogPath\WAU-updates.log" -ItemType SymbolicLink -Value $LogFile -Force -ErrorAction SilentlyContinue | Out-Null -} - #End Write-ToLog "End of process!" "Cyan" Start-Sleep 3