Compare commits

...

9 Commits

6 changed files with 5 additions and 131 deletions

View File

@ -312,8 +312,7 @@
"panel": "2", "panel": "2",
"Order": "a083_", "Order": "a083_",
"Type": "Button", "Type": "Button",
"ButtonWidth": "300", "ButtonWidth": "300"
"link": "https://christitustech.github.io/winutil/dev/features/Powershell-Profile/PSProfileInstall"
}, },
"WPFWinUtilUninstallPSProfile": { "WPFWinUtilUninstallPSProfile": {
"Content": "Uninstall CTT PowerShell Profile", "Content": "Uninstall CTT PowerShell Profile",
@ -321,8 +320,7 @@
"panel": "2", "panel": "2",
"Order": "a084_", "Order": "a084_",
"Type": "Button", "Type": "Button",
"ButtonWidth": "300", "ButtonWidth": "300"
"link": "https://christitustech.github.io/winutil/dev/features/Powershell-Profile/PSProfileUninstall"
}, },
"WPFWinUtilSSHServer": { "WPFWinUtilSSHServer": {
"Content": "Enable OpenSSH Server", "Content": "Enable OpenSSH Server",

View File

@ -1,38 +0,0 @@
# Install CTT PowerShell Profile
Last Updated: 2024-10-01
!!! info
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
<!-- BEGIN CUSTOM CONTENT -->
<!-- END CUSTOM CONTENT -->
<details>
<summary>Preview Code</summary>
```json
{
"Content": "Install CTT PowerShell Profile",
"category": "Powershell Profile",
"panel": "2",
"Order": "a083_",
"Type": "Button",
"ButtonWidth": "300",
"link": "https://christitustech.github.io/winutil/dev/features/Powershell-Profile/PSProfileInstall"
}
```
</details>
<!-- BEGIN SECOND CUSTOM CONTENT -->
<!-- END SECOND CUSTOM CONTENT -->
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/feature.json)

View File

@ -1,38 +0,0 @@
# Uninstall CTT PowerShell Profile
Last Updated: 2024-10-01
!!! info
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
<!-- BEGIN CUSTOM CONTENT -->
<!-- END CUSTOM CONTENT -->
<details>
<summary>Preview Code</summary>
```json
{
"Content": "Uninstall CTT PowerShell Profile",
"category": "Powershell Profile",
"panel": "2",
"Order": "a084_",
"Type": "Button",
"ButtonWidth": "300",
"link": "https://christitustech.github.io/winutil/dev/features/Powershell-Profile/PSProfileUninstall"
}
```
</details>
<!-- BEGIN SECOND CUSTOM CONTENT -->
<!-- END SECOND CUSTOM CONTENT -->
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/feature.json)

View File

@ -175,6 +175,9 @@ function Invoke-WinUtilUninstallPSProfile {
# Silently cleanup the oldprofile.ps1 file that was created when the CTT PowerShell profile was installed. # Silently cleanup the oldprofile.ps1 file that was created when the CTT PowerShell profile was installed.
Remove-Item "$env:USERPROFILE\oldprofile.ps1" | Out-Null Remove-Item "$env:USERPROFILE\oldprofile.ps1" | Out-Null
# Silently cleanup the $PSProfile.hash file that was created when the CTT PowerShell profile was installed.
Remove-Item "$PSProfile.hash" | Out-Null
} else { } else {
# Let the user know that the CTT PowerShell profile is not installed and that the uninstallation was skipped. # Let the user know that the CTT PowerShell profile is not installed and that the uninstallation was skipped.
Write-Host "===> Chris Titus Tech's PowerShell Profile Not Found. Skipped Uninstallation. <===" -ForegroundColor Magenta Write-Host "===> Chris Titus Tech's PowerShell Profile Not Found. Skipped Uninstallation. <===" -ForegroundColor Magenta

View File

@ -1,50 +0,0 @@
function Invoke-WinUtilpsProfile {
<#
.SYNOPSIS
Installs & applies the CTT Powershell Profile
#>
Invoke-WPFRunspace -Argumentlist $PROFILE -DebugPreference $DebugPreference -ScriptBlock {
param ( $psprofile)
function Invoke-PSSetup {
$url = "https://raw.githubusercontent.com/ChrisTitusTech/powershell-profile/main/Microsoft.PowerShell_profile.ps1"
$oldhash = Get-FileHash $psprofile -ErrorAction SilentlyContinue
Invoke-RestMethod $url -OutFile "$env:temp/Microsoft.PowerShell_profile.ps1"
$newhash = Get-FileHash "$env:temp/Microsoft.PowerShell_profile.ps1"
if ($newhash.Hash -ne $oldhash.Hash) {
write-host "===> Installing Profile.. <===" -ForegroundColor Yellow
# Starting new hidden shell process bc setup does not work in a runspace
Start-Process -FilePath "pwsh" -ArgumentList "-ExecutionPolicy Bypass -NoProfile -Command `"Invoke-Expression (Invoke-WebRequest `'https://github.com/ChrisTitusTech/powershell-profile/raw/main/setup.ps1`')`"" -WindowStyle Hidden -Wait
Write-Host "Profile has been installed. Please restart your shell to reflect changes!" -ForegroundColor Magenta
write-host "===> Finished <===" -ForegroundColor Yellow
} else {
Write-Host "Profile is up to date" -ForegroundColor Green
}
}
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
if ($PSVersionTable.PSVersion.Major -ge 7) {
Invoke-PSSetup
}
else {
write-host "Profile requires Powershell 7, which is currently installed but not used!" -ForegroundColor Red
# Load the necessary assembly for Windows Forms
Add-Type -AssemblyName System.Windows.Forms
# Display the Yes/No message box
$question = [System.Windows.Forms.MessageBox]::Show("Profile requires Powershell 7, which is currently installed but not used! Do you want to install Profile for Powershell 7?", "Question",
[System.Windows.Forms.MessageBoxButtons]::YesNo,
[System.Windows.Forms.MessageBoxIcon]::Question)
# Check the result
if ($question -eq [System.Windows.Forms.DialogResult]::Yes) {
Invoke-PSSetup
}
else {
Write-Host "Not proceeding with the profile setup!"
}
}
}
else {
write-host "Profile requires Powershell 7, which is not installed!" -ForegroundColor Red
}
}
}

View File

@ -50,7 +50,6 @@ function Invoke-WPFButton {
"WPFFixesNetwork" {Invoke-WPFFixesNetwork} "WPFFixesNetwork" {Invoke-WPFFixesNetwork}
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable} "WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity} "WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}
"WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil" -RunAsAdmin $true}
"WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"} "WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"}
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"} "WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
"WPFGetIso" {Invoke-MicrowinGetIso} "WPFGetIso" {Invoke-MicrowinGetIso}