mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 09:04:47 -05:00
Trim Trailing Whitespace
This commit is contained in:
@ -32,18 +32,18 @@ Function Get-WinUtilCheckBoxes {
|
||||
if ($uncheck -eq $true){
|
||||
$CheckBox.value.ischecked = $false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($Group -eq "WPFTweaks"){
|
||||
$filter = Get-WinUtilVariables -Type Checkbox | Where-Object {$psitem -like "WPF*Tweaks*"}
|
||||
$CheckBoxes = $sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter}
|
||||
Foreach ($CheckBox in $CheckBoxes){
|
||||
if($CheckBox.value.ischecked -eq $true){
|
||||
$Output.Add($Checkbox.Name)
|
||||
|
||||
|
||||
if ($uncheck -eq $true){
|
||||
$CheckBox.value.ischecked = $false
|
||||
}
|
||||
@ -57,7 +57,7 @@ Function Get-WinUtilCheckBoxes {
|
||||
Foreach ($CheckBox in $CheckBoxes){
|
||||
if($CheckBox.value.ischecked -eq $true){
|
||||
$Output.Add($Checkbox.Name)
|
||||
|
||||
|
||||
if ($uncheck -eq $true){
|
||||
$CheckBox.value.ischecked = $false
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Get-WinUtilInstallerProcess {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Meant to check for running processes and will return a boolean response
|
||||
|
||||
|
||||
#>
|
||||
|
||||
param($Process)
|
||||
|
@ -1,14 +1,14 @@
|
||||
function Get-WinUtilRegistry {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will make all modifications to the registry
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
||||
|
||||
#>
|
||||
|
||||
#>
|
||||
param (
|
||||
$Name,
|
||||
$Path,
|
||||
@ -16,7 +16,7 @@ function Get-WinUtilRegistry {
|
||||
$Value
|
||||
)
|
||||
|
||||
Try{
|
||||
Try{
|
||||
$syscheckvalue = Get-ItemPropertyValue -Path $Path -Value $Value # Return Value
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
Function Get-WinUtilToggleStatus {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Meant to pull the registry keys for a toggle switch and returns true or false
|
||||
|
||||
True should mean status is enabled
|
||||
False should mean status is disabled
|
||||
|
||||
|
||||
#>
|
||||
|
||||
Param($ToggleSwitch)
|
||||
@ -15,7 +15,7 @@ Function Get-WinUtilToggleStatus {
|
||||
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
|
||||
if($app -eq 0 -and $system -eq 0){
|
||||
return $true
|
||||
}
|
||||
}
|
||||
else{
|
||||
return $false
|
||||
}
|
||||
@ -24,7 +24,7 @@ Function Get-WinUtilToggleStatus {
|
||||
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
|
||||
if($bingsearch -eq 0){
|
||||
return $false
|
||||
}
|
||||
}
|
||||
else{
|
||||
return $true
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
function Get-WinUtilVariables {
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
placeholder
|
||||
|
||||
|
||||
#>
|
||||
param (
|
||||
[Parameter()]
|
||||
@ -12,7 +12,7 @@ function Get-WinUtilVariables {
|
||||
[string]$Type
|
||||
)
|
||||
|
||||
$keys = $sync.keys | Where-Object {$psitem -like "WPF*"}
|
||||
$keys = $sync.keys | Where-Object {$psitem -like "WPF*"}
|
||||
|
||||
if($type){
|
||||
$output = $keys | ForEach-Object {
|
||||
@ -23,7 +23,7 @@ function Get-WinUtilVariables {
|
||||
}
|
||||
Catch{<#I am here so errors don't get outputted for a couple variables that don't have the .GetType() attribute#>}
|
||||
}
|
||||
return $output
|
||||
return $output
|
||||
}
|
||||
return $keys
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
function Install-WinUtilChoco {
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Function is meant to ensure Choco is installed
|
||||
|
||||
Function is meant to ensure Choco is installed
|
||||
|
||||
#>
|
||||
|
||||
try{
|
||||
@ -14,7 +14,7 @@ function Install-WinUtilChoco {
|
||||
Write-Host "Chocolatey Already Installed"
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Write-Host "Seems Chocolatey is not installed, installing now?"
|
||||
#Let user decide if he wants to install Chocolatey
|
||||
$confirmation = Read-Host "Are you Sure You Want To Proceed:(y/n)"
|
||||
|
@ -1,12 +1,12 @@
|
||||
Function Install-WinUtilProgramWinget {
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This will install programs via Winget using a new powershell.exe instance to prevent the GUI from locking up.
|
||||
|
||||
Note the triple quotes are required any time you need a " in a normal script block.
|
||||
|
||||
|
||||
#>
|
||||
|
||||
param(
|
||||
@ -20,7 +20,7 @@ Function Install-WinUtilProgramWinget {
|
||||
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
||||
|
||||
Foreach ($Program in $($ProgramsToInstall -split ",")){
|
||||
|
||||
|
||||
Write-Progress -Activity "$manage Applications" -Status "$manage $Program $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||
if($manage -eq "Installing"){
|
||||
Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --silent $Program" -NoNewWindow -Wait
|
||||
@ -28,7 +28,7 @@ Function Install-WinUtilProgramWinget {
|
||||
if($manage -eq "Uninstalling"){
|
||||
Start-Process -FilePath winget -ArgumentList "uninstall -e --purge --force --silent $Program" -NoNewWindow -Wait
|
||||
}
|
||||
|
||||
|
||||
$X++
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
function Get-LatestHash {
|
||||
$shaUrl = ((Invoke-WebRequest $apiLatestUrl -UseBasicParsing | ConvertFrom-Json).assets | Where-Object { $_.name -match '^Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.txt$' }).browser_download_url
|
||||
|
||||
|
||||
$shaFile = Join-Path -Path $tempFolder -ChildPath 'Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.txt'
|
||||
$WebClient.DownloadFile($shaUrl, $shaFile)
|
||||
|
||||
|
||||
Get-Content $shaFile
|
||||
}
|
||||
|
||||
function Install-WinUtilWinget {
|
||||
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Function is meant to ensure winget is installed
|
||||
|
||||
Function is meant to ensure winget is installed
|
||||
|
||||
#>
|
||||
Try{
|
||||
Write-Host "Checking if Winget is Installed..."
|
||||
@ -39,7 +39,7 @@ function Install-WinUtilWinget {
|
||||
|
||||
Write-Host "Running Alternative Installer and Direct Installing"
|
||||
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "irm https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/winget.ps1 | iex"
|
||||
|
||||
|
||||
Write-Host "Winget Installed"
|
||||
}
|
||||
Catch{
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WinUtilBingSearch {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Sets Bing Search on or off
|
||||
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
Try{
|
||||
|
@ -46,19 +46,19 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
$registryKeys = $sync.configs.tweaks.$Config.registry
|
||||
$scheduledtaskKeys = $sync.configs.tweaks.$Config.scheduledtask
|
||||
$serviceKeys = $sync.configs.tweaks.$Config.service
|
||||
|
||||
|
||||
if($registryKeys -or $scheduledtaskKeys -or $serviceKeys){
|
||||
$Values = @()
|
||||
|
||||
|
||||
Foreach ($tweaks in $registryKeys){
|
||||
Foreach($tweak in $tweaks){
|
||||
|
||||
|
||||
if(test-path $tweak.Path){
|
||||
$actualValue = Get-ItemProperty -Name $tweak.Name -Path $tweak.Path -ErrorAction SilentlyContinue | Select-Object -ExpandProperty $($tweak.Name)
|
||||
$expectedValue = $tweak.Value
|
||||
if ($expectedValue -notlike $actualValue){
|
||||
$values += $False
|
||||
$values += $False
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,7 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
Foreach ($tweaks in $scheduledtaskKeys){
|
||||
Foreach($tweak in $tweaks){
|
||||
$task = $ScheduledTasks | Where-Object {$($psitem.TaskPath + $psitem.TaskName) -like "\$($tweak.name)"}
|
||||
|
||||
|
||||
if($task){
|
||||
$actualValue = $task.State
|
||||
$expectedValue = $tweak.State
|
||||
@ -81,7 +81,7 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
Foreach ($tweaks in $serviceKeys){
|
||||
Foreach($tweak in $tweaks){
|
||||
$Service = Get-Service -Name $tweak.Name
|
||||
|
||||
|
||||
if($Service){
|
||||
$actualValue = $Service.StartType
|
||||
$expectedValue = $tweak.StartupType
|
||||
|
@ -1,9 +1,9 @@
|
||||
Function Invoke-WinUtilDarkMode {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Sets Dark Mode on or off
|
||||
|
||||
|
||||
#>
|
||||
Param($DarkMoveEnabled)
|
||||
Try{
|
||||
@ -15,7 +15,7 @@ Function Invoke-WinUtilDarkMode {
|
||||
Write-Host "Disabling Dark Mode"
|
||||
$DarkMoveValue = 1
|
||||
}
|
||||
|
||||
|
||||
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||
Set-ItemProperty -Path $Theme -Name AppsUseLightTheme -Value $DarkMoveValue
|
||||
Set-ItemProperty -Path $Theme -Name SystemUsesLightTheme -Value $DarkMoveValue
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WinUtilFeatureInstall {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function converts all the values from the tweaks.json and routes them to the appropriate function
|
||||
|
||||
|
||||
#>
|
||||
|
||||
param(
|
||||
@ -13,7 +13,7 @@ function Invoke-WinUtilFeatureInstall {
|
||||
$CheckBox | ForEach-Object {
|
||||
if($sync.configs.feature.$psitem.feature){
|
||||
Foreach( $feature in $sync.configs.feature.$psitem.feature ){
|
||||
Try{
|
||||
Try{
|
||||
Write-Host "Installing $feature"
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName $feature -All -NoRestart
|
||||
}
|
||||
@ -24,10 +24,10 @@ function Invoke-WinUtilFeatureInstall {
|
||||
|
||||
else{
|
||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($sync.configs.feature.$psitem.InvokeScript){
|
||||
Foreach( $script in $sync.configs.feature.$psitem.InvokeScript ){
|
||||
@ -44,10 +44,10 @@ function Invoke-WinUtilFeatureInstall {
|
||||
|
||||
else{
|
||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
function Invoke-WinUtilScript {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will run a separate powershell script. Meant for things that can't be handled with the other functions
|
||||
|
||||
@ -8,7 +8,7 @@ function Invoke-WinUtilScript {
|
||||
|
||||
$Scriptblock = [scriptblock]::Create({"Write-output 'Hello World'"})
|
||||
Invoke-WinUtilScript -ScriptBlock $scriptblock -Name "Hello World"
|
||||
|
||||
|
||||
#>
|
||||
param (
|
||||
$Name,
|
||||
@ -38,7 +38,7 @@ function Invoke-WinUtilScript {
|
||||
Catch {
|
||||
# Generic catch block to handle any other type of exception
|
||||
Write-Warning "Unable to run script for $name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WinUtilTweaks {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function converts all the values from the tweaks.json and routes them to the appropriate function
|
||||
|
||||
|
||||
#>
|
||||
|
||||
param(
|
||||
@ -18,7 +18,7 @@ function Invoke-WinUtilTweaks {
|
||||
ScriptType = "UndoScript"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Else{
|
||||
$Values = @{
|
||||
Registry = "Value"
|
||||
|
@ -1,13 +1,13 @@
|
||||
function Remove-WinUtilAPPX {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will remove any of the provided APPX names
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Remove-WinUtilAPPX -Name "Microsoft.Microsoft3DViewer"
|
||||
|
||||
|
||||
#>
|
||||
param (
|
||||
$Name
|
||||
@ -24,11 +24,11 @@ function Remove-WinUtilAPPX {
|
||||
}
|
||||
Else{
|
||||
Write-Warning "Unable to uninstall $name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
||||
Catch{
|
||||
Write-Warning "Unable to uninstall $name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
function Set-WinUtilDNS {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will set the DNS of all interfaces that are in the "Up" state. It will lookup the values from the DNS.Json file
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilDNS -DNSProvider "google"
|
||||
|
||||
|
||||
#>
|
||||
param($DNSProvider)
|
||||
if($DNSProvider -eq "Default"){return}
|
||||
@ -27,6 +27,6 @@ function Set-WinUtilDNS {
|
||||
}
|
||||
Catch{
|
||||
Write-Warning "Unable to set DNS Provider due to an unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
function Set-WinUtilRegistry {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will make all modifications to the registry
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
||||
|
||||
#>
|
||||
|
||||
#>
|
||||
param (
|
||||
$Name,
|
||||
$Path,
|
||||
@ -16,7 +16,7 @@ function Set-WinUtilRegistry {
|
||||
$Value
|
||||
)
|
||||
|
||||
Try{
|
||||
Try{
|
||||
if(!(Test-Path 'HKU:\')){New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS}
|
||||
|
||||
If (!(Test-Path $Path)) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
function Set-WinUtilRestorePoint {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will make a Restore Point
|
||||
|
||||
#>
|
||||
#>
|
||||
|
||||
# Check if the user has administrative privileges
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
@ -24,7 +24,7 @@ function Set-WinUtilRestorePoint {
|
||||
$exists = Get-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -name "SystemRestorePointCreationFrequency" -ErrorAction SilentlyContinue
|
||||
if($null -eq $exists){
|
||||
write-host 'Changing system to allow multiple restore points per day'
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name "SystemRestorePointCreationFrequency" -Value "0" -Type DWord -Force -ErrorAction Stop | Out-Null
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name "SystemRestorePointCreationFrequency" -Value "0" -Type DWord -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
|
||||
# Get all the restore points for the current day
|
||||
@ -33,7 +33,7 @@ function Set-WinUtilRestorePoint {
|
||||
# Check if there is already a restore point created today
|
||||
if ($existingRestorePoints.Count -eq 0) {
|
||||
$description = "System Restore Point created by WinUtil"
|
||||
|
||||
|
||||
Checkpoint-Computer -Description $description -RestorePointType "MODIFY_SETTINGS"
|
||||
Write-Host -ForegroundColor Green "System Restore Point Created Successfully"
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
function Set-WinUtilScheduledTask {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will enable/disable the provided Scheduled Task
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilScheduledTask -Name "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" -State "Disabled"
|
||||
|
||||
|
||||
#>
|
||||
param (
|
||||
$Name,
|
||||
@ -35,6 +35,6 @@ function Set-WinUtilScheduledTask {
|
||||
}
|
||||
Catch{
|
||||
Write-Warning "Unable to run script for $name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,24 +1,24 @@
|
||||
Function Set-WinUtilService {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will change the startup type of services and start/stop them as needed
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilService -Name "HomeGroupListener" -StartupType "Manual"
|
||||
|
||||
#>
|
||||
|
||||
#>
|
||||
param (
|
||||
$Name,
|
||||
$StartupType
|
||||
)
|
||||
try {
|
||||
Write-Host "Setting Service $Name to $StartupType"
|
||||
|
||||
|
||||
# Check if the service exists
|
||||
$service = Get-Service -Name $Name -ErrorAction Stop
|
||||
|
||||
|
||||
# Service exists, proceed with changing properties
|
||||
$service | Set-Service -StartupType $StartupType -ErrorAction Stop
|
||||
}
|
||||
@ -29,5 +29,5 @@ Function Set-WinUtilService {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $_.Exception.Message
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
function Set-WinUtilUITheme {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will set theme to the XAML file
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilUITheme -inputXAML $inputXAML
|
||||
|
||||
|
||||
#>
|
||||
param
|
||||
(
|
||||
@ -41,7 +41,7 @@ function Set-WinUtilUITheme {
|
||||
}
|
||||
catch {
|
||||
Write-Warning "Unable to apply theme"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
|
||||
return $inputXML;
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Test-WinUtilPackageManager {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Checks for Winget or Choco depending on the parameter
|
||||
|
||||
|
||||
#>
|
||||
|
||||
Param(
|
||||
|
@ -1,10 +1,10 @@
|
||||
Function Update-WinUtilProgramWinget {
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This will update programs via Winget using a new powershell.exe instance to prevent the GUI from locking up.
|
||||
|
||||
|
||||
#>
|
||||
|
||||
[ScriptBlock]$wingetinstall = {
|
||||
|
@ -1,15 +1,15 @@
|
||||
function Invoke-WPFButton {
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Meant to make creating buttons easier. There is a section below in the gui that will assign this function to every button.
|
||||
This way you can dictate what each button does from this function.
|
||||
|
||||
Input will be the name of the button that is clicked.
|
||||
This way you can dictate what each button does from this function.
|
||||
|
||||
Input will be the name of the button that is clicked.
|
||||
#>
|
||||
|
||||
Param ([string]$Button)
|
||||
|
||||
Param ([string]$Button)
|
||||
|
||||
#Use this to get the name of the button
|
||||
#[System.Windows.MessageBox]::Show("$Button","Chris Titus Tech's Windows Utility","OK","Info")
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFControlPanel {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Simple Switch for legacy windows
|
||||
|
||||
|
||||
#>
|
||||
param($Panel)
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFFeatureInstall {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
GUI Function to install Windows Features
|
||||
|
||||
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
@ -26,12 +26,12 @@ function Invoke-WPFFeatureInstall {
|
||||
Write-Host "--- Features are Installed ---"
|
||||
Write-Host "--- A Reboot may be required ---"
|
||||
Write-Host "==================================="
|
||||
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
$MessageboxTitle = "All features are now installed "
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFFixesNetwork {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
|
||||
Write-Host "Resetting Network with netsh"
|
||||
|
@ -1,10 +1,10 @@
|
||||
function Invoke-WPFFixesUpdate {
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
|
||||
### Reset Windows Update Script - reregister dlls, services, and remove registry entries.
|
||||
|
@ -1,9 +1,9 @@
|
||||
Function Invoke-WPFFormVariables {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
#If ($global:ReadmeDisplay -ne $true) { Write-Host "If you need to reference this display again, run Get-FormVariables" -ForegroundColor Yellow; $global:ReadmeDisplay = $true }
|
||||
|
||||
|
@ -31,9 +31,9 @@ function Invoke-WPFGetInstalled {
|
||||
if($checkbox -eq "tweaks"){
|
||||
Write-Host "Getting Installed Tweaks..."
|
||||
}
|
||||
|
||||
|
||||
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox $checkbox
|
||||
|
||||
|
||||
$sync.form.Dispatcher.invoke({
|
||||
foreach($checkbox in $Checkboxes){
|
||||
$sync.$checkbox.ischecked = $True
|
||||
|
@ -1,13 +1,13 @@
|
||||
function Invoke-WPFImpex {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function handles importing and exporting of the checkboxes checked for the tweaks section
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Invoke-WPFImpex -type "export"
|
||||
|
||||
|
||||
#>
|
||||
param(
|
||||
$type,
|
||||
@ -18,7 +18,7 @@ function Invoke-WPFImpex {
|
||||
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
|
||||
}
|
||||
if ($type -eq "import"){
|
||||
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
|
||||
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
|
||||
}
|
||||
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
@ -28,7 +28,7 @@ function Invoke-WPFImpex {
|
||||
if($FileBrowser.FileName -eq ""){
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if ($type -eq "export"){
|
||||
$jsonFile = Get-WinUtilCheckBoxes $checkbox -unCheck $false
|
||||
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFInstall {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
@ -35,7 +35,7 @@ function Invoke-WPFInstall {
|
||||
$MessageboxTitle = "Installs are Finished "
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
|
||||
Write-Host "==========================================="
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFInstallUpgrade {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
if(!(Test-WinUtilPackageManager -winget)){
|
||||
Write-Host "==========================================="
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFPanelAutologin {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
curl.exe -ss "https://live.sysinternals.com/Autologon.exe" -o $env:temp\autologin.exe # Official Microsoft recommendation https://learn.microsoft.com/en-us/sysinternals/downloads/autologon
|
||||
cmd /c $env:temp\autologin.exe /accepteula
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFPanelDISM {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
Start-Process PowerShell -ArgumentList "Write-Host '(1/4) Chkdsk' -ForegroundColor Green; Chkdsk /scan;
|
||||
Write-Host '`n(2/4) SFC - 1st scan' -ForegroundColor Green; sfc /scannow;
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFRunspace {
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Simple function to make it easier to invoke a runspace from inside the script.
|
||||
Simple function to make it easier to invoke a runspace from inside the script.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
@ -14,14 +14,14 @@ function Invoke-WPFRunspace {
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace @params
|
||||
|
||||
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
$ScriptBlock,
|
||||
$ArgumentList
|
||||
)
|
||||
)
|
||||
|
||||
#Crate a PowerShell instance.
|
||||
$script:powershell = [powershell]::Create()
|
||||
@ -30,7 +30,7 @@ function Invoke-WPFRunspace {
|
||||
$script:powershell.AddScript($ScriptBlock)
|
||||
$script:powershell.AddArgument($ArgumentList)
|
||||
$script:powershell.RunspacePool = $sync.runspace
|
||||
|
||||
|
||||
#Run our RunspacePool.
|
||||
$script:handle = $script:powershell.BeginInvoke()
|
||||
|
||||
|
@ -9,7 +9,7 @@ function Invoke-WPFShortcut {
|
||||
|
||||
Switch ($ShortcutToAdd) {
|
||||
"WinUtil" {
|
||||
$SourceExe = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
|
||||
$SourceExe = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
|
||||
$IRM = 'irm https://christitus.com/win | iex'
|
||||
$Powershell = '-ExecutionPolicy Bypass -Command "Start-Process powershell.exe -verb runas -ArgumentList'
|
||||
$ArgumentsToSourceExe = "$powershell '$IRM'"
|
||||
@ -28,6 +28,6 @@ function Invoke-WPFShortcut {
|
||||
$Shortcut.TargetPath = $SourceExe
|
||||
$Shortcut.Arguments = $ArgumentsToSourceExe
|
||||
$Shortcut.Save()
|
||||
|
||||
|
||||
Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName)"
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function Invoke-WPFTab {
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Sole purpose of this function is to reduce duplicated code for switching between tabs.
|
||||
|
||||
Sole purpose of this function is to reduce duplicated code for switching between tabs.
|
||||
|
||||
#>
|
||||
|
||||
Param ($ClickedTab)
|
||||
@ -13,7 +13,7 @@ function Invoke-WPFTab {
|
||||
$x = [int]($ClickedTab -replace "WPFTab","" -replace "BT","") - 1
|
||||
|
||||
0..($Tabs.Count -1 ) | ForEach-Object {
|
||||
|
||||
|
||||
if ($x -eq $psitem){
|
||||
$sync.$TabNav.Items[$psitem].IsSelected = $true
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
function Invoke-WPFToggle {
|
||||
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
Meant to make creating toggle switches easier. There is a section below in the gui that will assign this function to every switch.
|
||||
This way you can dictate what each button does from this function.
|
||||
|
||||
Input will be the name of the toggle that is checked.
|
||||
This way you can dictate what each button does from this function.
|
||||
|
||||
Input will be the name of the toggle that is checked.
|
||||
#>
|
||||
|
||||
Param ([string]$Button)
|
||||
|
||||
Param ([string]$Button)
|
||||
|
||||
#Use this to get the name of the button
|
||||
#[System.Windows.MessageBox]::Show("$Button","Chris Titus Tech's Windows Utility","OK","Info")
|
||||
|
@ -1,9 +1,9 @@
|
||||
Function Invoke-WPFUltimatePerformance {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
param($State)
|
||||
Try{
|
||||
@ -31,7 +31,7 @@ Function Invoke-WPFUltimatePerformance {
|
||||
}
|
||||
else {
|
||||
Write-Host "Power scheme '$powerSchemeName' already exists."
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($state -eq "Disabled"){
|
||||
# Define the name of the power scheme you want to remove
|
||||
@ -50,10 +50,10 @@ Function Invoke-WPFUltimatePerformance {
|
||||
|
||||
if($null -ne $guid){
|
||||
Write-Host "Found power scheme '$powerSchemeName' with GUID $guid. Removing..."
|
||||
|
||||
|
||||
# Remove the power scheme
|
||||
powercfg /delete $guid
|
||||
|
||||
|
||||
Write-Host "Power scheme removed successfully."
|
||||
}
|
||||
else {
|
||||
@ -65,7 +65,7 @@ Function Invoke-WPFUltimatePerformance {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Catch{
|
||||
Write-Warning $psitem.Exception.Message
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFUnInstall {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
@ -41,7 +41,7 @@ function Invoke-WPFUnInstall {
|
||||
$MessageboxTitle = "Uninstalls are Finished "
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
|
||||
Write-Host "==========================================="
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFUpdatesdefault {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFUpdatesdisable {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFUpdatessecurity {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
Write-Host "Disabling driver offering through Windows Update..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata")) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFtweaksbutton {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
|
@ -1,9 +1,9 @@
|
||||
function Invoke-WPFundoall {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
|
||||
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
@ -18,8 +18,8 @@ function Invoke-WPFundoall {
|
||||
$msg = "Please check the tweaks you wish to undo."
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks -ScriptBlock {
|
||||
param($Tweaks)
|
||||
|
||||
|
Reference in New Issue
Block a user