Fixed the typing in all advanced functions

- Removed empty End {} blocks
- Removed Mandatory = $false parameters
- Added SupportsShouldProcess where supported
- Rename show-dialog-window.psm1 to show-message-dialog.psm1
- Move ui-helper, select-folder-gui and show-message-dialog to the "ui" subfolder
- Don't display the BGR color anymore on new-system-color
- Used Begin { } and Process { } blocks where needed
- Updated all imports where needed
main
Plínio Larrubia 2 years ago committed by Plínio Larrubia
parent e55156553a
commit 2b82728641
No known key found for this signature in database
GPG Key ID: 057B0A87CB137C69

@ -9,13 +9,13 @@ function Main() {
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"download-web-file.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"get-hardware-info.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"ui-helper.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"open-file.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"manage-software.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"set-console-style.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"show-dialog-window.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"start-logging.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"title-templates.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\ui\"show-message-dialog.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\lib\ui\"ui-helper.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\utils\"individual-tweaks.psm1" -Force
Import-Module -DisableNameChecking $PSScriptRoot\src\utils\"install-individual-system-apps.psm1" -Force
@ -44,20 +44,20 @@ function Request-AdminPrivilege() {
}
function Show-GUI() {
Write-Status -Types "@" -Status "Loading GUI Layout..."
Write-Status -Types "@", "UI" -Status "Loading GUI Layout..."
# Loading System Libs
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
[System.Windows.Forms.Application]::EnableVisualStyles() # Rounded Buttons :3
Set-UIFont # Load the Layout Font
$ScreenWidth, $ScreenHeight = Get-CurrentResolution # Get the Screen Size
$ScreenProportion = $ScreenWidth / $ScreenHeight # 16:9 ~1.777...
$Script:NeedRestart = $false
$DoneTitle = "Information"
$DoneMessage = "Process Completed!"
Set-UIFont # Load the Layout Font
$ScreenWidth, $ScreenHeight = Get-CurrentResolution # Get the Screen Size
$ScreenProportion = $ScreenWidth / $ScreenHeight # 16:9 ~1.777...
# <===== PERSONAL LAYOUT =====>
# To Scroll
@ -1532,7 +1532,7 @@ function Show-GUI() {
}
If (($AppsSelected.WingetApps.Count -ge 1) -or ($AppsSelected.MSStoreApps.Count -ge 1) -or ($AppsSelected.ChocolateyApps.Count -ge 1) -or ($AppsSelected.WSLDistros.Count -ge 1)) {
Show-Message -Title "$DoneTitle" -Message "$SoftwareList"
Show-MessageDialog -Title "$DoneTitle" -Message "$SoftwareList"
}
$SoftwareList = ""
})

@ -1,18 +1,18 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\"title-templates.psm1"
function Remove-ItemVerified() {
[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Position = 0, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[String] $Path,
[String] $Path,
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[String[]] $Include,
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[String[]] $Exclude,
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[Switch] $Recurse,
[Switch] $Recurse,
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[Switch] $Force
[Switch] $Force
)
Begin {
@ -38,7 +38,4 @@ function Remove-ItemVerified() {
Write-Status -Types "?", $TweakType -Status "The path $Path does not exist" -Warning
}
}
End {
}
}

@ -3,13 +3,13 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\"title-templates.psm1"
function Set-ScheduledTaskState() {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[Parameter(Position = 0, Mandatory)]
[ValidateSet('Disabled', 'Enabled')]
[String] $State,
[Parameter(Mandatory = $true)]
[Array] $ScheduledTasks,
[Parameter(Mandatory = $false)]
[Array] $Filter
[Parameter(Position = 1, Mandatory)]
[String[]] $ScheduledTasks,
[Parameter(Position = 2)]
[String[]] $Filter
)
Begin {

@ -1,16 +1,14 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\"title-templates.psm1"
function Set-ServiceStartup() {
[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Mandatory = $true)]
[ValidateSet('Automatic', 'Boot', 'Disabled', 'Manual', 'System')]
[String] $State,
[String] $State,
[Parameter(Mandatory = $true)]
[Array] $Services,
[Parameter(Mandatory = $false)]
[Array] $Filter,
[Parameter(Mandatory = $false)]
[String[]] $Services,
[String[]] $Filter,
[ScriptBlock] $CustomMessage
)

@ -1,7 +1,7 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\"title-templates.psm1"
function Set-ItemPropertyVerified() {
[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Position = 0, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[String] $Path,
@ -30,7 +30,4 @@ function Set-ItemPropertyVerified() {
Set-ItemProperty -Path "$Path" -Name "$Name" -Value $Value
}
}
End {
}
}

@ -1,10 +1,10 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\"title-templates.psm1"
function Remove-UWPAppx() {
[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Mandatory = $true)]
[Array] $AppxPackages
[Parameter(Position = 0, Mandatory)]
[String[]] $AppxPackages
)
Begin {

@ -3,11 +3,11 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\"title-templates.psm1"
function Set-CapabilityState() {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[Parameter(Position = 0, Mandatory)]
[ValidateSet('Disabled', 'Enabled')]
[String] $State,
[Parameter(Mandatory = $true)]
[Array] $Capabilities
[Parameter(Position = 1, Mandatory)]
[String[]] $Capabilities
)
Begin {

@ -3,13 +3,12 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\"title-templates.psm1"
function Set-OptionalFeatureState() {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[Parameter(Position = 0, Mandatory)]
[ValidateSet('Disabled', 'Enabled')]
[String] $State,
[Parameter(Mandatory = $true)]
[Array] $OptionalFeatures,
[Parameter(Mandatory = $false)]
[Array] $Filter
[Parameter(Position = 1, Mandatory)]
[String[]] $OptionalFeatures,
[String[]] $Filter
)
Begin {

@ -4,9 +4,11 @@ function Request-FileDownload {
[CmdletBinding()]
[OutputType([String])]
param (
[Parameter(Position = 0, Mandatory)]
[String] $FileURI,
[Parameter(Mandatory = $false)]
[Parameter(Position = 1)]
[String] $OutputFolder,
[Parameter(Position = 2, Mandatory)]
[String] $OutputFile
)
@ -39,12 +41,17 @@ function Request-FileDownload {
function Get-APIFile {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory)]
[String] $URI,
[Parameter(Position = 1, Mandatory)]
[String] $ObjectProperty,
[Parameter(Position = 2, Mandatory)]
[String] $FileNameLike,
[Parameter(Position = 3, Mandatory)]
[String] $PropertyValue,
[Parameter(Mandatory = $false)]
[Parameter(Position = 4)]
[String] $OutputFolder,
[Parameter(Position = 5, Mandatory)]
[String] $OutputFile
)

@ -5,7 +5,6 @@ function Get-CPU() {
[OutputType([String])]
param (
[Switch] $NameOnly,
[Parameter(Mandatory = $false)]
[String] $Separator = '|'
)
@ -88,7 +87,6 @@ function Get-DriveSpace() {
[CmdletBinding()]
[OutputType([String])]
param (
[Parameter(Mandatory = $false)]
[String] $DriveLetter = $env:SystemDrive[0]
)
@ -104,11 +102,10 @@ function Get-SystemSpec() {
[CmdletBinding()]
[OutputType([System.Object[]])]
param (
[Parameter(Mandatory = $false)]
[String] $Separator = '|'
)
Write-Status -Types "@" -Status "Loading system specs..."
Write-Status -Types "@", "Info" -Status "Loading system specs..."
# Adapted From: https://www.delftstack.com/howto/powershell/find-windows-version-in-powershell/#using-the-wmi-class-with-get-wmiobject-cmdlet-in-powershell-to-get-the-windows-version
$WinVer = (Get-CimInstance -class Win32_OperatingSystem).Caption -replace 'Microsoft ', ''
$DisplayVersion = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").DisplayVersion
@ -116,4 +113,4 @@ function Get-SystemSpec() {
$DisplayedVersionResult = '(' + @{ $true = $DisplayVersion; $false = $OldBuildNumber }[$null -ne $DisplayVersion] + ')'
return $(Get-OSDriveType), $Separator, $WinVer, $DisplayedVersionResult, $Separator, $(Get-RAM), $Separator, $(Get-CPU -Separator $Separator), $Separator, $(Get-GPU)
}
}

@ -5,6 +5,7 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Grant-RegistryPermission() {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory)]
[String] $Key
)

@ -5,6 +5,7 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Install-Font() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[String] $FontSourceFolder = "$PSScriptRoot\src\tmp\fonts"
)

@ -1,14 +1,15 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-message-dialog.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Install-Software() {
[CmdletBinding()]
[OutputType([String])]
param (
[Parameter(Position = 0, Mandatory)]
[String] $Name,
[Array] $Packages,
[Parameter(Position = 1, Mandatory)]
[String[]] $Packages,
[ScriptBlock] $InstallBlock = { winget install --silent --source "winget" --id $Package },
[Parameter(Mandatory = $false)]
[Switch] $NoDialog,
[String] $PkgMngr = 'Winget',
[Switch] $ViaChocolatey,
@ -74,7 +75,7 @@ function Install-Software() {
Write-Host "$DoneMessage" -ForegroundColor Cyan
If (!($NoDialog)) {
Show-Message -Title "$DoneTitle" -Message "$DoneMessage"
Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage"
}
return $DoneMessage
@ -84,8 +85,10 @@ function Uninstall-Software() {
[CmdletBinding()]
[OutputType([String])]
param (
[Parameter(Position = 0, Mandatory)]
[String] $Name,
[Array] $Packages,
[Parameter(Position = 1, Mandatory)]
[String[]] $Packages,
[ScriptBlock] $UninstallBlock = { winget uninstall --source "winget" --id $Package },
[Parameter(Mandatory = $false)]
[Switch] $NoDialog,
@ -151,7 +154,7 @@ function Uninstall-Software() {
Write-Host "$DoneMessage" -ForegroundColor Cyan
If (!($NoDialog)) {
Show-Message -Title "$DoneTitle" -Message "$DoneMessage"
Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage"
}
return $DoneMessage

@ -1,44 +1,49 @@
# Adapted From: https://shellgeek.com/create-shortcuts-on-user-desktop-using-powershell/
# Short circuit code: https://stackoverflow.com/a/26768902
Import-Module -DisableNameChecking $PSScriptRoot\"title-templates.psm1"
function New-Shortcut() {
[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Position = 0, Mandatory)]
[String] $SourcePath,
[Parameter(Position = 1)]
[String] $ShortcutPath = "$([Environment]::GetFolderPath("Desktop"))\$((Split-Path -Path $SourcePath -Leaf).Split('.')[0]).lnk",
[Parameter(Mandatory = $false)]
[String] $Description = "Opens $(Split-Path -Path $SourcePath -Leaf)",
[Parameter(Mandatory = $false)]
[Parameter(Position = 2)]
[String] $IconLocation = "$SourcePath, 0",
[Parameter(Mandatory = $false)]
[Parameter(Position = 3)]
[String] $Arguments = '',
[Parameter(Mandatory = $false)]
[Parameter(Position = 4)]
[String] $Hotkey = '',
[Parameter(Mandatory = $false)]
[String] $WindowStyle = 1 # I'm not sure, but i'll take the UI as example: 1 = Normal, 2 = Minimized, 3 = Maximized
[Parameter(Position = 5)]
[ValidateSet(1, 2, 3)]
[Int] $WindowStyle = 1 # I'm not sure, but i'll take the UI as example: 1 = Normal, 2 = Minimized, 3 = Maximized
)
If (!(Test-Path -Path (Split-Path -Path $ShortcutPath))) {
Write-Status -Types "?" -Status "$((Split-Path -Path $ShortcutPath)) does not exist, creating it..."
New-Item -Path (Split-Path -Path $ShortcutPath) -ItemType Directory -Force
}
Process {
If (!(Test-Path -Path (Split-Path -Path $ShortcutPath))) {
Write-Status -Types "?" -Status "$((Split-Path -Path $ShortcutPath)) does not exist, creating it..."
New-Item -Path (Split-Path -Path $ShortcutPath) -ItemType Directory -Force
}
$WScriptObj = New-Object -ComObject ("WScript.Shell")
$Shortcut = $WScriptObj.CreateShortcut($ShortcutPath)
$Shortcut.TargetPath = $SourcePath
$WScriptObj = New-Object -ComObject ("WScript.Shell")
$Shortcut = $WScriptObj.CreateShortcut($ShortcutPath)
$Shortcut.TargetPath = $SourcePath
If ($Hotkey) {
$Shortcut.Description = "$Description ($Hotkey)"
} Else {
$Shortcut.Description = $Description
}
If ($Hotkey) {
$Shortcut.Description = "$Description ($Hotkey)"
} Else {
$Shortcut.Description = $Description
}
$Shortcut.Arguments = $Arguments
$ShortCut.Hotkey = $Hotkey
$Shortcut.IconLocation = $IconLocation
$Shortcut.WindowStyle = $WindowStyle
$Shortcut.Arguments = $Arguments
$ShortCut.Hotkey = $Hotkey
$Shortcut.IconLocation = $IconLocation
$Shortcut.WindowStyle = $WindowStyle
$Shortcut.Save()
$Shortcut.Save()
}
}
<#
@ -66,4 +71,4 @@ function New-Shortcut() {
"$env:SystemRoot\System32\wiashext.dll, 2" >>> Icons from Hardware in Image
"$env:SystemRoot\System32\comres.dll, 2" >>> Icons from Actions
"$env:SystemRoot\System32\comres.dll, 2" >>> More Icons from Network, Sound and logo from Windows 8
#>
#>

@ -1,16 +1,17 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-message-dialog.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Open-PowerShellFilesCollection {
[CmdletBinding()]
param (
[String] $RelativeLocation,
[Array] $Scripts,
[String] $DoneTitle,
[String] $DoneMessage,
[Parameter(Mandatory = $false)]
[Bool] $OpenFromGUI = $true,
[Switch] $NoDialog
[Parameter(Position = 0, Mandatory)]
[String] $RelativeLocation,
[Parameter(Position = 1, Mandatory)]
[String[]] $Scripts,
[String] $DoneTitle,
[String] $DoneMessage,
[Bool] $OpenFromGUI = $true,
[Switch] $NoDialog
)
Push-Location -Path $(Join-Path -Path "$PSScriptRoot\..\.." -ChildPath "$RelativeLocation")
@ -29,7 +30,7 @@ function Open-PowerShellFilesCollection {
Pop-Location
If (!($NoDialog)) {
Show-Message -Title "$DoneTitle" -Message "$DoneMessage"
Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage"
}
}
@ -54,7 +55,7 @@ function Open-RegFilesCollection {
Pop-Location
If (!($NoDialog)) {
Show-Message -Title "$DoneTitle" -Message "$DoneMessage"
Show-MessageDialog -Title "$DoneTitle" -Message "$DoneMessage"
}
}
@ -64,4 +65,4 @@ Open-PowerShellFilesCollection -RelativeLocation "src\scripts" -Scripts "script.
Open-PowerShellFilesCollection -RelativeLocation "src\scripts" -Scripts @("script1.ps1", "script2.ps1") -DoneTitle "Title" -DoneMessage "Message" -OpenFromGUI $false
Open-RegFilesCollection -RelativeLocation "src\scripts" -Scripts "script.reg" -NoDialog
Open-RegFilesCollection -RelativeLocation "src\scripts" -Scripts @("script1.reg", "script2.reg") -DoneTitle "Title" -DoneMessage "Message"
#>
#>

@ -1,5 +1,11 @@
function Set-ConsoleStyle() {
[CmdletBinding()] param ()
[CmdletBinding()] param (
[Parameter(Position = 0)]
[ValidateSet(1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F')]
[String] $Color = 'A'
)
cmd /c color A
}
Process {
cmd /c color $Color
}
}

@ -1,15 +1,22 @@
function Start-Logging {
[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Position = 0)]
[String] $Path = "$env:TEMP\Win-DT-Logs",
[Parameter(Position = 1, Mandatory)]
[String] $File
)
$Date = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
$File = "$File`_$Date.log"
Write-Host -NoNewline "[@] " -ForegroundColor Blue
Start-Transcript -Path "$Path\$File"
Write-Host
Begin {
$Date = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
$File = "$File`_$Date.log"
}
Process {
Write-Host -NoNewline "[@] " -ForegroundColor Blue
Start-Transcript -Path "$Path\$File"
Write-Host
}
}
function Stop-Logging {
@ -23,4 +30,4 @@ Example:
Start-Logging -File (Split-Path -Path $PSCommandPath -Leaf).Split(".")[0]
Start-Logging -Path "$env:TEMP\Win-DT-Logs" -File "WingetDailyUpgrade" # Automatically uses .log format
Stop-Logging # Only after logging has started
#>
#>

@ -1,6 +1,7 @@
function Write-Title() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[String] $Text = "No Text"
)
@ -12,6 +13,7 @@
function Write-Section() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[String] $Text = "No Text"
)
@ -23,6 +25,7 @@ function Write-Section() {
function Write-Caption() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[String] $Text = "No Text"
)
@ -33,11 +36,11 @@ function Write-Caption() {
function Write-Status() {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[Array] $Types,
[Parameter(Mandatory)]
[String] $Status,
[Switch] $Warning
[Parameter(Position = 0, Mandatory)]
[String[]] $Types,
[Parameter(Position = 1, Mandatory)]
[String] $Status,
[Switch] $Warning
)
ForEach ($Type in $Types) {
@ -57,13 +60,16 @@ function Write-TitleCounter() {
[CmdletBinding()]
[OutputType([System.Int32])]
param (
[Parameter(Position = 0)]
[String] $Text = "No Text",
[Parameter(Position = 1)]
[Int] $Counter = 0,
[Parameter(Position = 2)]
[Int] $MaxLength
)
$Counter += 1
Write-Title -Text "($Counter/$MaxLength) $Text"
Write-Title -Text "($Counter/$MaxLength) - $Text"
return $Counter
}
@ -102,4 +108,4 @@ Write-Status -Types "?", ... -Status "Doing something" -Warning
$Private:Counter = Write-TitleCounter -Text "Text" -Counter $Counter -MaxLenght 100 # Used to print when working with collections # No need to iterate $Counter before, as long it's private
$Private:Counter = Write-TitleCounter -Text "Text" -Counter $Counter -MaxLenght 100 # Used to print when working with collections # No need to iterate $Counter before, as long it's private
Write-ScriptLogo # Used at the start of the Script
#>
#>

@ -3,7 +3,9 @@
function Select-Folder() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[String] $Description = "Select a folder",
[Parameter(Position = 1)]
[String] $InitialDirectory = "$env:SystemDrive"
)
@ -28,4 +30,4 @@ function Select-Folder() {
Example:
$Folder = Select-Folder -Description "Select a folder where X files are located"
$Folder = Select-Folder -Description "Select a folder where X files are located" -InitialDirectory "C:\Windows\Temp"
#>
#>

@ -3,13 +3,19 @@ function Use-WindowsForm() {
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null # Load assembly
}
function Show-Message() {
function Show-MessageDialog() {
[CmdletBinding()]
[OutputType([System.Windows.Forms.DialogResult])]
param (
[Parameter(Position = 0)]
[String] $Title = "Insert title here",
[Array] $Message = "`nCrash`nBandicoot",
[String] $BoxButtons = "OK", # AbortRetryIgnore, OK, OKCancel, RetryCancel, YesNo, YesNoCancel
[Parameter(Position = 1)]
[String] $Message = "`nCrash`nBandicoot",
[Parameter(Position = 2)]
[ValidateSet('AbortRetryIgnore', 'OK', 'OKCancel', 'RetryCancel', 'YesNo', 'YesNoCancel')]
[String] $BoxButtons = "OK",
[Parameter(Position = 3)]
[ValidateSet('Information', 'Question', 'Warning', 'Error', 'None')]
[String] $BoxIcon = "Information" # Information, Question, Warning, Error or None
)
@ -21,9 +27,15 @@ function Show-Question() {
[CmdletBinding()]
[OutputType([System.Windows.Forms.DialogResult])]
param (
[Parameter(Position = 0)]
[String] $Title = "Insert title here",
[Array] $Message = "Crash`nBandicoot",
[Parameter(Position = 1)]
[String] $Message = "Crash`nBandicoot",
[Parameter(Position = 2)]
[ValidateSet('AbortRetryIgnore', 'OK', 'OKCancel', 'RetryCancel', 'YesNo', 'YesNoCancel')]
[String] $BoxButtons = "YesNoCancel", # With Yes, No and Cancel, the user can press Esc to exit
[Parameter(Position = 3)]
[ValidateSet('Information', 'Question', 'Warning', 'Error', 'None')]
[String] $BoxIcon = "Question"
)
@ -53,8 +65,8 @@ function Request-PcRestart() {
<#
Example:
Show-Message -Title "Title" -Message "Message"
Show-MessageDialog -Title "Title" -Message "Message"
$Question = Show-Question -Title "Title" -Message "Message"
Request-PcRestart
Returns Yes or No or Cancel
#>
#>

@ -1,4 +1,4 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\"title-templates.psm1"
# Adapted from: https://stackoverflow.com/a/35965782
# Adapted from: https://www.osdeploy.com/modules/pshot/technical/resolution-scale-and-dpi
@ -158,7 +158,9 @@ function New-Form() {
[String] $BackColor = "#252525", # Windows Dark
[Bool] $Minimize = $true,
[Bool] $Maximize = $true,
[String] $FormBorderStyle = 'FixedSingle', # FixedSingle, Fixed3D, FixedDialog, Sizable, FixedToolWindow, SizableToolWindow
[ValidateSet('FixedSingle', 'FixedSingle', 'Fixed3D', 'FixedDialog', 'Sizable', 'FixedToolWindow', 'SizableToolWindow')]
[String] $FormBorderStyle = 'FixedSingle',
[ValidateSet('Manual', 'CenterScreen', 'WindowsDefaultLocation', 'WindowsDefaultBounds', 'CenterParent')]
[String] $StartPosition = 'CenterScreen',
[Bool] $TopMost = $false
)
@ -284,6 +286,7 @@ function New-Label() {
[Int] $FontSize = 14,
[String] $FontStyle = "Regular",
[String] $ForeColor = "#55EE00", # Green
[ValidateSet('TopLeft', 'TopCenter', 'TopRight', 'MiddleLeft', 'MiddleCenter', 'MiddleRight', 'BottomLeft', 'BottomCenter', 'BottomRight')]
[String] $TextAlign = "MiddleCenter"
)
@ -320,8 +323,10 @@ function New-Button() {
[String] $FontStyle = "Regular",
[String] $ForeColor = "#FFFFFF", # White
[String] $BackColor = "#2C2C2C", # Dark Gray
[ValidateSet('TopLeft', 'TopCenter', 'TopRight', 'MiddleLeft', 'MiddleCenter', 'MiddleRight', 'BottomLeft', 'BottomCenter', 'BottomRight')]
[String] $TextAlign = "MiddleCenter",
[String] $FlatStyle = "Flat", # Flat, Popup, Standard, System
[ValidateSet('Flat', 'Popup', 'Standard', 'System')]
[String] $FlatStyle = "Flat",
[String] $BorderSize = 1
)
@ -361,6 +366,7 @@ function New-CheckBox() {
[String] $FontStyle = "Italic",
[String] $ForeColor = "#FFFFFF", # White
[String] $BackColor = "#2C2C2C", # Dark Gray
[ValidateSet('TopLeft', 'TopCenter', 'TopRight', 'MiddleLeft', 'MiddleCenter', 'MiddleRight', 'BottomLeft', 'BottomCenter', 'BottomRight')]
[String] $TextAlign = "MiddleLeft"
)
@ -396,7 +402,8 @@ function New-PictureBox() {
[Int] $MarginTop = 0,
[Int] $LocationX,
[Int] $LocationY,
[String] $SizeMode = 'Zoom' # Autosize, CenterImage, Normal, StretchImage, Zoom
[ValidateSet('Autosize', 'CenterImage', 'Normal', 'StretchImage', 'Zoom')]
[String] $SizeMode = 'Zoom'
)
Write-Verbose "PictureBox: IL $ImageLocation, W$Width, H$Height, X$LocationX, Y$LocationY, SM $SizeMode"
@ -413,4 +420,4 @@ function New-PictureBox() {
}
return $PictureBox
}
}

@ -1,36 +1,40 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Unregister-DuplicatedPowerPlan() {
$ExistingPowerPlans = $((powercfg -L)[3..(powercfg -L).Count])
# Found on the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\Default\PowerSchemes
$BuiltInPowerPlans = @{
"Power Saver" = "a1841308-3541-4fab-bc81-f71556f20b4a"
"Balanced (recommended)" = "381b4222-f694-41f0-9685-ff5bb260df2e"
"High Performance" = "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"
"Ultimate Performance" = "e9a42b02-d5df-448d-aa00-03f14749eb61"
Begin {
$ExistingPowerPlans = $((powercfg -L)[3..(powercfg -L).Count])
# Found on the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\Default\PowerSchemes
$BuiltInPowerPlans = @{
"Power Saver" = "a1841308-3541-4fab-bc81-f71556f20b4a"
"Balanced (recommended)" = "381b4222-f694-41f0-9685-ff5bb260df2e"
"High Performance" = "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"
"Ultimate Performance" = "e9a42b02-d5df-448d-aa00-03f14749eb61"
}
$UniquePowerPlans = $BuiltInPowerPlans.Clone()
}
$UniquePowerPlans = $BuiltInPowerPlans.Clone()
Write-Status -Types "@" -Status "Cleaning up duplicated Power plans..."
ForEach ($PowerCfgString in $ExistingPowerPlans) {
$PowerPlanGUID = $PowerCfgString.Split(':')[1].Split('(')[0].Trim()
$PowerPlanName = $PowerCfgString.Split('(')[-1].Replace(')', '').Trim()
Process {
Write-Status -Types "@" -Status "Cleaning up duplicated Power plans..."
ForEach ($PowerCfgString in $ExistingPowerPlans) {
$PowerPlanGUID = $PowerCfgString.Split(':')[1].Split('(')[0].Trim()
$PowerPlanName = $PowerCfgString.Split('(')[-1].Replace(')', '').Trim()
If (($PowerPlanGUID -in $BuiltInPowerPlans.Values)) {
Write-Status -Types "@" -Status "The '$PowerPlanName' power plan is built-in, skipping $PowerPlanGUID..." -Warning
Continue
}
If (($PowerPlanGUID -in $BuiltInPowerPlans.Values)) {
Write-Status -Types "@" -Status "The '$PowerPlanName' power plan is built-in, skipping $PowerPlanGUID..." -Warning
Continue
}
Try {
If (($PowerPlanName -notin $UniquePowerPlans.Keys) -and ($PowerPlanGUID -notin $UniquePowerPlans.Values)) {
$UniquePowerPlans.Add($PowerPlanName, $PowerPlanGUID)
} Else {
Try {
If (($PowerPlanName -notin $UniquePowerPlans.Keys) -and ($PowerPlanGUID -notin $UniquePowerPlans.Values)) {
$UniquePowerPlans.Add($PowerPlanName, $PowerPlanGUID)
} Else {
Write-Status -Types "-" -Status "Duplicated '$PowerPlanName' power plan found, deleting $PowerPlanGUID..."
powercfg -Delete $PowerPlanGUID
}
} Catch {
Write-Status -Types "-" -Status "Duplicated '$PowerPlanName' power plan found, deleting $PowerPlanGUID..."
powercfg -Delete $PowerPlanGUID
}
} Catch {
Write-Status -Types "-" -Status "Duplicated '$PowerPlanName' power plan found, deleting $PowerPlanGUID..."
powercfg -Delete $PowerPlanGUID
}
}
}

@ -8,14 +8,14 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Install-PackageManager() {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory)]
[String] $PackageManagerFullName,
[Parameter(Position = 1, Mandatory)]
[ScriptBlock] $CheckExistenceBlock,
[Parameter(Position = 2, Mandatory)]
[ScriptBlock] $InstallCommandBlock,
[Parameter(Mandatory = $false)]
[String] $Time,
[Parameter(Mandatory = $false)]
[ScriptBlock] $UpdateScriptBlock,
[Parameter(Mandatory = $false)]
[ScriptBlock] $PostInstallBlock
)

@ -1,8 +1,8 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"manage-software.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"select-folder-gui.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"show-dialog-window.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"title-templates.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\debloat-helper\"remove-item-verified.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\ui\"select-folder-gui.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\ui\"show-message-dialog.psm1"
function Request-AdminPrivilege() {
# Used from https://stackoverflow.com/a/31602095 because it preserves the working directory!
@ -204,10 +204,9 @@ function Import-KeysSshGpg() {
Push-Location $Folder
ssh-add $(Get-ChildItem)
Pop-Location
$Folder = $null
}
$Folder = $null
$Folder = Select-Folder -Description "Select the existing GPG keys folder"
If ($null -ne $Folder) {
Write-Host "Importing GPG keys from: $Folder" -ForegroundColor Cyan

@ -2,84 +2,88 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"title-templates.psm1
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\debloat-helper\"set-item-property-verified.psm1"
function New-SystemColor() {
$ColorHistory = Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\History\Colors"
$HexColor = "{0:X6}" -f (Get-Random -Maximum 0xFFFFFF)
$HexColorBGR = "$($HexColor[4..5] + $HexColor[2..3] + $HexColor[0..1])".Split(" ") -join ""
$PathToCUDesktop = "HKCU:\Control Panel\Desktop"
$PathToCUExplorerAccent = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent"
$PathToCUThemesColorHistory = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\History\Colors"
$PathToCUThemesHistory = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\History"
$PathToCUThemesPersonalize = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
$PathToCUWindowsDWM = "HKCU:\SOFTWARE\Microsoft\Windows\DWM"
$Max = 32
$RandomBytes = [System.Collections.ArrayList]@()
ForEach ($i in 1..$Max) {
$Byte = "0x{0:X2}" -f (Get-Random -Maximum 0xFF)
If ($i % 4 -eq 0) {
$Byte = "0xFF"
Begin {
$ColorHistory = Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\History\Colors"
$HexColor = "{0:X6}" -f (Get-Random -Maximum 0xFFFFFF)
$HexColorBGR = "$($HexColor[4..5] + $HexColor[2..3] + $HexColor[0..1])".Split(" ") -join ""
$PathToCUDesktop = "HKCU:\Control Panel\Desktop"
$PathToCUExplorerAccent = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent"
$PathToCUThemesColorHistory = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\History\Colors"
$PathToCUThemesHistory = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\History"
$PathToCUThemesPersonalize = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
$PathToCUWindowsDWM = "HKCU:\SOFTWARE\Microsoft\Windows\DWM"
$Max = 32
$RandomBytes = [System.Collections.ArrayList]@()
ForEach ($i in 1..$Max) {
$Byte = "0x{0:X2}" -f (Get-Random -Maximum 0xFF)
If ($i % 4 -eq 0) {
$Byte = "0xFF"
}
If ($i -eq $Max) {
$Byte = "0x00"
}
If ($i -in (1, 5, 9, 13, 17, 21, 25)) {
$Byte = "0x$($HexColor[0..1])".Split(" ") -join ""
}
If ($i -in (2, 6, 10, 14, 18, 22, 26)) {
$Byte = "0x$($HexColor[2..3])".Split(" ") -join ""
}
If ($i -in (3, 7, 11, 15, 19, 23, 27)) {
$Byte = "0x$($HexColor[4..5])".Split(" ") -join ""
}
$RandomBytes.Add($Byte)
}
If ($i -eq $Max) {
$Byte = "0x00"
}
If ($i -in (1, 5, 9, 13, 17, 21, 25)) {
$Byte = "0x$($HexColor[0..1])".Split(" ") -join ""
}
If ($i -in (2, 6, 10, 14, 18, 22, 26)) {
$Byte = "0x$($HexColor[2..3])".Split(" ") -join ""
}
If ($i -in (3, 7, 11, 15, 19, 23, 27)) {
$Byte = "0x$($HexColor[4..5])".Split(" ") -join ""
}
$RandomBytes.Add($Byte)
}
Write-Status -Types "@" -Status "HexColor: #$HexColor, BGR: #$HexColorBGR"
Write-Verbose "$RandomBytes"
# Taskbar and Settings color
Set-ItemPropertyVerified -Path "$PathToCUExplorerAccent" -Name "AccentPalette" -Type Binary -Value ([byte[]]($RandomBytes[0], $RandomBytes[1], $RandomBytes[2], $RandomBytes[3], $RandomBytes[4], $RandomBytes[5], $RandomBytes[6], $RandomBytes[7], $RandomBytes[8], $RandomBytes[9], $RandomBytes[10], $RandomBytes[11], $RandomBytes[12], $RandomBytes[13], $RandomBytes[14], $RandomBytes[15], $RandomBytes[16], $RandomBytes[17], $RandomBytes[18], $RandomBytes[19], $RandomBytes[20], $RandomBytes[21], $RandomBytes[22], $RandomBytes[23], $RandomBytes[24], $RandomBytes[25], $RandomBytes[26], $RandomBytes[27], $RandomBytes[28], $RandomBytes[29], $RandomBytes[30], $RandomBytes[31]))
# Window Top Color
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "AccentColor" -Type DWord -Value 0xff$HexColor
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationAfterglow" -Type DWord -Value 0xc4$HexColor
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationColor" -Type DWord -Value 0xc4$HexColor
# Window Border Color
Set-ItemPropertyVerified -Path "$PathToCUExplorerAccent" -Name "AccentColorMenu" -Type DWord -Value 0xff$HexColorBGR
Set-ItemPropertyVerified -Path "$PathToCUExplorerAccent" -Name "StartColorMenu" -Type DWord -Value 0xff$HexColor
# Start, Taskbar and Action center
Set-ItemPropertyVerified -Path "$PathToCUThemesPersonalize" -Name "ColorPrevalence" -Type DWord -Value 0
# Title Bars and Windows Borders
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorPrevalence" -Type DWord -Value 1
# Window Color History
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory0" -Type DWord -Value 0xff$HexColorBGR
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory1" -Type DWord -Value $ColorHistory.ColorHistory0
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory2" -Type DWord -Value $ColorHistory.ColorHistory1
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory3" -Type DWord -Value $ColorHistory.ColorHistory2
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory4" -Type DWord -Value $ColorHistory.ColorHistory3
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory5" -Type DWord -Value $ColorHistory.ColorHistory4
# Miscellaneous stuff (didn't work)
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationAfterglowBalance" -Type DWord -Value 10
# Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationBlurBalance" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationColorBalance" -Type DWord -Value 89
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationGlassAttribute" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationGlassAttribute" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "EnableWindowColorization" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUDesktop" -Name "AutoColorization" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToCUThemesHistory" -Name "AutoColor" -Type DWord -Value 0
Process {
Write-Status -Types "@" -Status "RGB HexColor: #$HexColor"
Write-Verbose "$RandomBytes"
# Taskbar and Settings color
Set-ItemPropertyVerified -Path "$PathToCUExplorerAccent" -Name "AccentPalette" -Type Binary -Value ([byte[]]($RandomBytes[0], $RandomBytes[1], $RandomBytes[2], $RandomBytes[3], $RandomBytes[4], $RandomBytes[5], $RandomBytes[6], $RandomBytes[7], $RandomBytes[8], $RandomBytes[9], $RandomBytes[10], $RandomBytes[11], $RandomBytes[12], $RandomBytes[13], $RandomBytes[14], $RandomBytes[15], $RandomBytes[16], $RandomBytes[17], $RandomBytes[18], $RandomBytes[19], $RandomBytes[20], $RandomBytes[21], $RandomBytes[22], $RandomBytes[23], $RandomBytes[24], $RandomBytes[25], $RandomBytes[26], $RandomBytes[27], $RandomBytes[28], $RandomBytes[29], $RandomBytes[30], $RandomBytes[31]))
# Window Top Color
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "AccentColor" -Type DWord -Value 0xff$HexColor
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationAfterglow" -Type DWord -Value 0xc4$HexColor
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationColor" -Type DWord -Value 0xc4$HexColor
# Window Border Color
Set-ItemPropertyVerified -Path "$PathToCUExplorerAccent" -Name "AccentColorMenu" -Type DWord -Value 0xff$HexColorBGR
Set-ItemPropertyVerified -Path "$PathToCUExplorerAccent" -Name "StartColorMenu" -Type DWord -Value 0xff$HexColor
# Start, Taskbar and Action center
Set-ItemPropertyVerified -Path "$PathToCUThemesPersonalize" -Name "ColorPrevalence" -Type DWord -Value 0
# Title Bars and Windows Borders
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorPrevalence" -Type DWord -Value 1
# Window Color History
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory0" -Type DWord -Value 0xff$HexColorBGR
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory1" -Type DWord -Value $ColorHistory.ColorHistory0
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory2" -Type DWord -Value $ColorHistory.ColorHistory1
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory3" -Type DWord -Value $ColorHistory.ColorHistory2
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory4" -Type DWord -Value $ColorHistory.ColorHistory3
Set-ItemPropertyVerified -Path "$PathToCUThemesColorHistory" -Name "ColorHistory5" -Type DWord -Value $ColorHistory.ColorHistory4
# Miscellaneous stuff (didn't work)
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationAfterglowBalance" -Type DWord -Value 10
# Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationBlurBalance" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationColorBalance" -Type DWord -Value 89
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationGlassAttribute" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "ColorizationGlassAttribute" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUWindowsDWM" -Name "EnableWindowColorization" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUDesktop" -Name "AutoColorization" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToCUThemesHistory" -Name "AutoColor" -Type DWord -Value 0
}
}
New-SystemColor

@ -1,10 +1,10 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"show-dialog-window.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"ui-helper.psm1" # Load UI libs
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\ui\"show-message-dialog.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\ui\"ui-helper.psm1" # Load UI libs
function Show-DebloatInfo {
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)]
[Parameter(Position = 0)]
[String] $PostMessage,
[Switch] $Silent
)
@ -54,7 +54,7 @@ Storage Used ($env:SystemDrive): $($UsedStorage.ToString("#.#"))/$($TotalStorage
Write-Host "`n$Message`n" -ForegroundColor Cyan
If (!($Silent)) {
Show-Message -Title "$Title" -Message "$Message"
Show-MessageDialog -Title "$Title" -Message "$Message"
}
}
@ -65,4 +65,4 @@ Example:
Show-DebloatInfo
Show-DebloatInfo -PostMessage "PostMessage"
Show-DebloatInfo -PostMessage "PostMessage" -Silent
#>
#>

@ -7,25 +7,28 @@ function Remove-CapabilitiesList() {
[Switch] $Revert
)
$DisableCapabilities = @(
"App.StepsRecorder*" # Steps Recorder
"Browser.InternetExplorer*" # Internet Explorer (Also has on Optional Features)
"MathRecognizer*" # Math Recognizer
"Microsoft.Windows.PowerShell.ISE*" # PowerShell ISE
"Microsoft.Windows.WordPad*" # WordPad
"Print.Fax.Scan*" # Fax features
"Print.Management.Console*" # printmanagement.msc
)
Write-Title -Text "Windows Capabilities Tweaks"
Write-Section -Text "Uninstall Windows Capabilities from Windows"
Begin {
$DisableCapabilities = @(
"App.StepsRecorder*" # Steps Recorder
"Browser.InternetExplorer*" # Internet Explorer (Also has on Optional Features)
"MathRecognizer*" # Math Recognizer
"Microsoft.Windows.PowerShell.ISE*" # PowerShell ISE
"Microsoft.Windows.WordPad*" # WordPad
"Print.Fax.Scan*" # Fax features
"Print.Management.Console*" # printmanagement.msc
)
}
If ($Revert) {
Write-Status -Types "*", "Capability" -Status "Reverting the tweaks is set to '$Revert'." -Warning
Set-CapabilityState -State Enabled -Capabilities $DisableCapabilities
} Else {
Set-CapabilityState -State Disabled -Capabilities $DisableCapabilities
Process {
Write-Title -Text "Windows Capabilities Tweaks"
Write-Section -Text "Uninstall Windows Capabilities from Windows"
If ($Revert) {
Write-Status -Types "*", "Capability" -Status "Reverting the tweaks is set to '$Revert'." -Warning
Set-CapabilityState -State Enabled -Capabilities $DisableCapabilities
} Else {
Set-CapabilityState -State Disabled -Capabilities $DisableCapabilities
}
}
}

Loading…
Cancel
Save