From ec3166bdc69c7df75a6e0942f59deba7375a5538 Mon Sep 17 00:00:00 2001 From: Gabi <218829269+GabiNun2@users.noreply.github.com> Date: Thu, 7 May 2026 13:52:20 -0700 Subject: [PATCH] Update Invoke-WinUtilInstallPSProfile.ps1 (#4456) * Update Invoke-WinUtilInstallPSProfile.ps1 * Update Invoke-WinUtilUninstallPSProfile.ps1 * Update Invoke-WinUtilInstallPSProfile.ps1 * Update Invoke-WinUtilUninstallPSProfile.ps1 --- .../private/Invoke-WinUtilInstallPSProfile.ps1 | 15 +++++++++++---- .../private/Invoke-WinUtilUninstallPSProfile.ps1 | 11 +++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/functions/private/Invoke-WinUtilInstallPSProfile.ps1 b/functions/private/Invoke-WinUtilInstallPSProfile.ps1 index f5eba446..c5517d21 100644 --- a/functions/private/Invoke-WinUtilInstallPSProfile.ps1 +++ b/functions/private/Invoke-WinUtilInstallPSProfile.ps1 @@ -1,8 +1,15 @@ function Invoke-WinUtilInstallPSProfile { - - if (Test-Path $Profile) { - Rename-Item $Profile -NewName ($Profile + '.bak') + if (-not (Get-Command wt)) { + Write-Host "Windows Terminal not found installing..." + Install-WinUtilWinget + winget install Microsoft.WindowsTerminal --source winget --silent } - Start-Process pwsh -ArgumentList '-Command "irm https://github.com/ChrisTitusTech/powershell-profile/raw/main/setup.ps1 | iex"' + if (-not (Get-Command pwsh)) { + Write-Host "Powershell 7 not found installing..." + Install-WinUtilWinget + winget install Microsoft.PowerShell --source winget --silent + } + + wt new-tab pwsh -NoExit -Command "irm https://github.com/ChrisTitusTech/powershell-profile/raw/main/setup.ps1 | iex" } diff --git a/functions/private/Invoke-WinUtilUninstallPSProfile.ps1 b/functions/private/Invoke-WinUtilUninstallPSProfile.ps1 index 1a2addc2..fe05b480 100644 --- a/functions/private/Invoke-WinUtilUninstallPSProfile.ps1 +++ b/functions/private/Invoke-WinUtilUninstallPSProfile.ps1 @@ -1,10 +1,9 @@ function Invoke-WinUtilUninstallPSProfile { - if (Test-Path ($Profile + '.bak')) { - Remove-Item $Profile - Rename-Item ($Profile + '.bak') -NewName $Profile - } - else { - Remove-Item $Profile + + if (Test-Path ($Profile + ".bak")) { + Move-Item -Path ($Profile + ".bak") -Destination $Profile + } else { + Remove-Item -Path $Profile } Write-Host "Successfully uninstalled CTT PowerShell Profile." -ForegroundColor Green