From 3585892ce872d1148d7bd2cb5d7eb49fef3f0724 Mon Sep 17 00:00:00 2001 From: Carter <60557606+Carterpersall@users.noreply.github.com> Date: Wed, 4 Oct 2023 10:42:31 -0500 Subject: [PATCH] Trim Trailing Whitespace (#1085) * Trim Trailing Whitespace * Revert "Trim Trailing Whitespace" This reverts commit 0ce32aa2c2fbf860138856375bdea05e119c36f4. * Trim Trailing Whitespace, take 2 --- Compile.ps1 | 4 +- config/applications.json | 4 +- config/feature.json | 2 +- config/helperscript.ps1 | 38 +++++++-------- config/tweaks.json | 18 +++---- functions/private/Get-WinUtilCheckBoxes.ps1 | 8 ++-- functions/private/Get-WinUtilRegistry.ps1 | 4 +- functions/private/Get-WinUtilToggleStatus.ps1 | 4 +- functions/private/Get-WinUtilVariables.ps1 | 4 +- functions/private/Install-WinUtilChoco.ps1 | 2 +- .../private/Install-WinUtilProgramWinget.ps1 | 4 +- functions/private/Install-WinUtilWinget.ps1 | 6 +-- .../private/Invoke-WinUtilCurrentSystem.ps1 | 10 ++-- functions/private/Invoke-WinUtilDarkMode.ps1 | 2 +- .../private/Invoke-WinUtilFeatureInstall.ps1 | 10 ++-- functions/private/Invoke-WinUtilScript.ps1 | 4 +- functions/private/Invoke-WinUtilTweaks.ps1 | 2 +- functions/private/Remove-WinUtilAPPX.ps1 | 4 +- functions/private/Set-WinUtilDNS.ps1 | 2 +- functions/private/Set-WinUtilRegistry.ps1 | 2 +- functions/private/Set-WinUtilRestorePoint.ps1 | 4 +- .../private/Set-WinUtilScheduledTask.ps1 | 2 +- functions/private/Set-WinUtilService.ps1 | 6 +-- functions/private/Set-WinUtilUiTheme.ps1 | 2 +- functions/public/Invoke-WPFButton.ps1 | 4 +- functions/public/Invoke-WPFFeatureInstall.ps1 | 4 +- functions/public/Invoke-WPFGetInstalled.ps1 | 4 +- functions/public/Invoke-WPFImpex.ps1 | 4 +- functions/public/Invoke-WPFInstall.ps1 | 2 +- functions/public/Invoke-WPFRunspace.ps1 | 4 +- functions/public/Invoke-WPFShortcut.ps1 | 4 +- functions/public/Invoke-WPFTab.ps1 | 2 +- functions/public/Invoke-WPFToggle.ps1 | 4 +- .../public/Invoke-WPFUltimatePerformance.ps1 | 8 ++-- functions/public/Invoke-WPFUnInstall.ps1 | 2 +- functions/public/Invoke-WPFundoall.ps1 | 4 +- lint/PSScriptAnalyser.ps1 | 2 +- ooshutup10_winutil_settings.cfg | 8 ++-- pester/configs.Tests.ps1 | 20 ++++---- pester/functions.Tests.ps1 | 4 +- pester/winutil.Tests.ps1 | 4 +- scripts/main.ps1 | 4 +- xaml/inputXML.xaml | 48 +++++++++---------- 43 files changed, 142 insertions(+), 142 deletions(-) diff --git a/Compile.ps1 b/Compile.ps1 index 04c19e9d52..d17b15af30 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -23,13 +23,13 @@ Get-ChildItem .\functions -Recurse -File | ForEach-Object { Get-ChildItem .\xaml | ForEach-Object { $xaml = (Get-Content $psitem.FullName).replace("'","''") - + Write-output "`$$($psitem.BaseName) = '$xaml'" | Out-File ./$scriptname -Append -Encoding ascii } Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object { $json = (Get-Content $psitem.FullName).replace("'","''") - + Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" | Out-File ./$scriptname -Append -Encoding ascii } diff --git a/config/applications.json b/config/applications.json index 57eab3c1de..4281f1cb6b 100755 --- a/config/applications.json +++ b/config/applications.json @@ -1,4 +1,4 @@ -{ +{ "WPFInstall7zip": { "winget": "7zip.7zip", "choco": "7zip" @@ -546,7 +546,7 @@ "WPFInstalltidal": { "Winget": "9NNCB5BS59PH", "choco": "na" - }, + }, "WPFInstallubisoft": { "winget": "Ubisoft.Connect", "choco": "ubisoft-connect" diff --git a/config/feature.json b/config/feature.json index 3707c66e36..1bb7f09f72 100644 --- a/config/feature.json +++ b/config/feature.json @@ -40,7 +40,7 @@ "Microsoft-Windows-Subsystem-Linux" ], "InvokeScript": [ - + ] }, "WPFFeaturenfs": { diff --git a/config/helperscript.ps1 b/config/helperscript.ps1 index 0bef372ddb..1b1b6d7a3d 100644 --- a/config/helperscript.ps1 +++ b/config/helperscript.ps1 @@ -85,7 +85,7 @@ Example: "ClientForNFS-Infrastructure", "NFS-Administration" ] -} +} #> # Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request. @@ -147,14 +147,14 @@ Example: "EssTweaksServices", "EssTweaksTele" ] -} +} #> # Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request. $NameofButton = "WPF" + "" $commands = @( - + ) $jsonfile = Get-Content ./config/preset.json | ConvertFrom-Json @@ -186,21 +186,21 @@ $jsonfile | ConvertTo-Json | Out-File ./config/preset.json "Path": "Path in registry", "Name": "Name of Registry key", "Type": "Item type", - "Value": "Value to modify", + "Value": "Value to modify", "OriginalValue": "value to reset" } ], "service" : [ { "Name": "Name of service", - "StartupType": "Startup type to set", + "StartupType": "Startup type to set", "OriginalType": "Startup type to reset" } ], "ScheduledTask" : [ { "Name": "Path to scheduled task", - "State": "State to set", + "State": "State to set", "OriginalState": "State to reset" } ], @@ -211,10 +211,10 @@ $jsonfile | ConvertTo-Json | Out-File ./config/preset.json "InvokeScript": [ "Script to make modifications not possible with the above types Special care needs to be taken here as converting from json to a scriptblock - can cause weird issues. Please look at the example below to get an idea of how things should work" + can cause weird issues. Please look at the example below to get an idea of how things should work" ], "UndoScript": [ - "Same as above however is meant to undo what you did above" + "Same as above however is meant to undo what you did above" ] } } @@ -228,14 +228,14 @@ Example: "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System", "Name": "EnableActivityFeed", "Type": "DWord", - "Value": "0", + "Value": "0", "OriginalValue": "1" }, { "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System", "Name": "PublishUserActivities", "Type": "DWord", - "Value": "0", + "Value": "0", "OriginalValue": "1" } ] @@ -244,12 +244,12 @@ Example: "service" : [ { "Name": "HomeGroupListener", - "StartupType": "Manual", + "StartupType": "Manual", "OriginalType": "Automatic" }, { "Name": "HomeGroupProvider", - "StartupType": "Manual", + "StartupType": "Manual", "OriginalType": "Automatic" } ] @@ -258,12 +258,12 @@ Example: "ScheduledTask" : [ { "Name": "Microsoft\\Windows\\Application Experience\\Microsoft Compatibility Appraiser", - "State": "Disabled", + "State": "Disabled", "OriginalState": "Enabled" - }, + }, { "Name": "Microsoft\\Windows\\Application Experience\\ProgramDataUpdater", - "State": "Disabled", + "State": "Disabled", "OriginalState": "Enabled" } ] @@ -279,7 +279,7 @@ Example: "Import-Module BitsTransfer Start-BitsTransfer -Source \"https://raw.githubusercontent.com/ChrisTitusTech/win10script/master/ooshutup10.cfg\" -Destination C:\\Windows\\Temp\\ooshutup10.cfg Start-BitsTransfer -Source \"https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe\" -Destination C:\\Windows\\Temp\\OOSU10.exe - C:\\Windows\\Temp\\OOSU10.exe C:\\Windows\\Temp\\ooshutup10.cfg /quiet" + C:\\Windows\\Temp\\OOSU10.exe C:\\Windows\\Temp\\ooshutup10.cfg /quiet" ] } } @@ -323,11 +323,11 @@ Example: #) #$InvokeScript = @( -# "" +# "" #) #$UndoScript = @( -# "" +# "" #) $NameofButton = "WPF" + "" @@ -375,7 +375,7 @@ Example: "Primary": "1.1.1.1", "Secondary": "1.0.0.1" } -} +} #> # Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request. diff --git a/config/tweaks.json b/config/tweaks.json index e0056958cf..794d6c3651 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -1853,7 +1853,7 @@ $preferences.Preferences[28] = 0 Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\TaskManager\" -Name \"Preferences\" -Type Binary -Value $preferences.Preferences } - Remove-Item -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}\" -Recurse -ErrorAction SilentlyContinue + Remove-Item -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\NameSpace\\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}\" -Recurse -ErrorAction SilentlyContinue # Group svchost.exe processes $ram = (Get-CimInstance -ClassName Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum).Sum / 1kb @@ -2089,26 +2089,26 @@ " $TeamsPath = [System.IO.Path]::Combine($env:LOCALAPPDATA, 'Microsoft', 'Teams') $TeamsUpdateExePath = [System.IO.Path]::Combine($TeamsPath, 'Update.exe') - + Write-Host \"Stopping Teams process...\" Stop-Process -Name \"*teams*\" -Force -ErrorAction SilentlyContinue - + Write-Host \"Uninstalling Teams from AppData\\Microsoft\\Teams\" if ([System.IO.File]::Exists($TeamsUpdateExePath)) { # Uninstall app $proc = Start-Process $TeamsUpdateExePath \"-uninstall -s\" -PassThru $proc.WaitForExit() } - + Write-Host \"Removing Teams AppxPackage...\" Get-AppxPackage \"*Teams*\" | Remove-AppxPackage -ErrorAction SilentlyContinue Get-AppxPackage \"*Teams*\" -AllUsers | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue - + Write-Host \"Deleting Teams directory\" if ([System.IO.Directory]::Exists($TeamsPath)) { Remove-Item $TeamsPath -Force -Recurse -ErrorAction SilentlyContinue } - + Write-Host \"Deleting Teams uninstall registry key\" # Uninstall from Uninstall registry key UninstallString $us = (Get-ChildItem -Path HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall, HKLM:\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -like '*Teams*'}).UninstallString @@ -2133,7 +2133,7 @@ "WPFEssTweaksStorage": { "InvokeScript": [ "Remove-Item -Path \"HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\StorageSense\\Parameters\\StoragePolicy\" -Recurse -ErrorAction SilentlyContinue" - ], + ], "UndoScript": [ "New-Item -Path \"HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\StorageSense\\Parameters\\StoragePolicy\" | Out-Null " @@ -2163,7 +2163,7 @@ }, "WPFEssTweaksRemoveEdge": { "InvokeScript": [ - " + " #:: Standalone script by AveYo Source: https://raw.githubusercontent.com/AveYo/fox/main/Edge_Removal.bat curl.exe -s \"https://raw.githubusercontent.com/AveYo/fox/main/Edge_Removal.bat\" -o $ENV:temp\\edgeremoval.bat @@ -2181,7 +2181,7 @@ "WPFEssTweaksRemoveOnedrive": { "InvokeScript": [ " - + Write-Host \"Kill OneDrive process\" taskkill.exe /F /IM \"OneDrive.exe\" taskkill.exe /F /IM \"explorer.exe\" diff --git a/functions/private/Get-WinUtilCheckBoxes.ps1 b/functions/private/Get-WinUtilCheckBoxes.ps1 index 1df0c84c96..fef27cc859 100644 --- a/functions/private/Get-WinUtilCheckBoxes.ps1 +++ b/functions/private/Get-WinUtilCheckBoxes.ps1 @@ -38,18 +38,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 } @@ -63,7 +63,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 } diff --git a/functions/private/Get-WinUtilRegistry.ps1 b/functions/private/Get-WinUtilRegistry.ps1 index 9a39795cd3..99b8e2f765 100644 --- a/functions/private/Get-WinUtilRegistry.ps1 +++ b/functions/private/Get-WinUtilRegistry.ps1 @@ -7,7 +7,7 @@ function Get-WinUtilRegistry { .EXAMPLE Get-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0" - #> + #> param ( $Name, $Path, @@ -15,7 +15,7 @@ function Get-WinUtilRegistry { $Value ) - Try{ + Try{ $syscheckvalue = Get-ItemPropertyValue -Path $Path -Value $Value # Return Value } diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index b0386904c3..38d2d6e6f3 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -18,7 +18,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 } @@ -27,7 +27,7 @@ Function Get-WinUtilToggleStatus { $bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled if($bingsearch -eq 0){ return $false - } + } else{ return $true } diff --git a/functions/private/Get-WinUtilVariables.ps1 b/functions/private/Get-WinUtilVariables.ps1 index d612e57c34..cd0309cb18 100644 --- a/functions/private/Get-WinUtilVariables.ps1 +++ b/functions/private/Get-WinUtilVariables.ps1 @@ -15,7 +15,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 { @@ -26,7 +26,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 } diff --git a/functions/private/Install-WinUtilChoco.ps1 b/functions/private/Install-WinUtilChoco.ps1 index e0890489db..c7f150ee4a 100644 --- a/functions/private/Install-WinUtilChoco.ps1 +++ b/functions/private/Install-WinUtilChoco.ps1 @@ -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 they want to install Chocolatey $confirmation = Read-Host "Are you Sure You Want To Proceed:(y/n)" diff --git a/functions/private/Install-WinUtilProgramWinget.ps1 b/functions/private/Install-WinUtilProgramWinget.ps1 index 16776c4299..dee2cb1f79 100644 --- a/functions/private/Install-WinUtilProgramWinget.ps1 +++ b/functions/private/Install-WinUtilProgramWinget.ps1 @@ -27,7 +27,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 @@ -35,7 +35,7 @@ Function Install-WinUtilProgramWinget { if($manage -eq "Uninstalling"){ Start-Process -FilePath winget -ArgumentList "uninstall -e --purge --force --silent $Program" -NoNewWindow -Wait } - + $X++ } diff --git a/functions/private/Install-WinUtilWinget.ps1 b/functions/private/Install-WinUtilWinget.ps1 index b04e6d9441..27d74b874b 100644 --- a/functions/private/Install-WinUtilWinget.ps1 +++ b/functions/private/Install-WinUtilWinget.ps1 @@ -1,9 +1,9 @@ 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 } @@ -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{ diff --git a/functions/private/Invoke-WinUtilCurrentSystem.ps1 b/functions/private/Invoke-WinUtilCurrentSystem.ps1 index eda05c3756..000dea4c07 100644 --- a/functions/private/Invoke-WinUtilCurrentSystem.ps1 +++ b/functions/private/Invoke-WinUtilCurrentSystem.ps1 @@ -43,19 +43,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 } } } @@ -64,7 +64,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 @@ -78,7 +78,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 diff --git a/functions/private/Invoke-WinUtilDarkMode.ps1 b/functions/private/Invoke-WinUtilDarkMode.ps1 index 064259f50f..52a917de3a 100644 --- a/functions/private/Invoke-WinUtilDarkMode.ps1 +++ b/functions/private/Invoke-WinUtilDarkMode.ps1 @@ -18,7 +18,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 diff --git a/functions/private/Invoke-WinUtilFeatureInstall.ps1 b/functions/private/Invoke-WinUtilFeatureInstall.ps1 index 8f197e1dfe..8fc6ee2cc5 100644 --- a/functions/private/Invoke-WinUtilFeatureInstall.ps1 +++ b/functions/private/Invoke-WinUtilFeatureInstall.ps1 @@ -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 } } - } + } } } } diff --git a/functions/private/Invoke-WinUtilScript.ps1 b/functions/private/Invoke-WinUtilScript.ps1 index e9516dfe9d..4059f91700 100644 --- a/functions/private/Invoke-WinUtilScript.ps1 +++ b/functions/private/Invoke-WinUtilScript.ps1 @@ -43,7 +43,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 } - + } \ No newline at end of file diff --git a/functions/private/Invoke-WinUtilTweaks.ps1 b/functions/private/Invoke-WinUtilTweaks.ps1 index 2a61555c09..e57a6e734e 100644 --- a/functions/private/Invoke-WinUtilTweaks.ps1 +++ b/functions/private/Invoke-WinUtilTweaks.ps1 @@ -24,7 +24,7 @@ function Invoke-WinUtilTweaks { ScriptType = "UndoScript" } - } + } Else{ $Values = @{ Registry = "Value" diff --git a/functions/private/Remove-WinUtilAPPX.ps1 b/functions/private/Remove-WinUtilAPPX.ps1 index 40fa9f9a87..db6471a5b3 100644 --- a/functions/private/Remove-WinUtilAPPX.ps1 +++ b/functions/private/Remove-WinUtilAPPX.ps1 @@ -26,11 +26,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 } } \ No newline at end of file diff --git a/functions/private/Set-WinUtilDNS.ps1 b/functions/private/Set-WinUtilDNS.ps1 index b636617cb9..314a5ac8e8 100644 --- a/functions/private/Set-WinUtilDNS.ps1 +++ b/functions/private/Set-WinUtilDNS.ps1 @@ -29,6 +29,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 } } diff --git a/functions/private/Set-WinUtilRegistry.ps1 b/functions/private/Set-WinUtilRegistry.ps1 index e4606952c3..a5c67fbc3b 100644 --- a/functions/private/Set-WinUtilRegistry.ps1 +++ b/functions/private/Set-WinUtilRegistry.ps1 @@ -27,7 +27,7 @@ function Set-WinUtilRegistry { $Value ) - Try{ + Try{ if(!(Test-Path 'HKU:\')){New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS} If (!(Test-Path $Path)) { diff --git a/functions/private/Set-WinUtilRestorePoint.ps1 b/functions/private/Set-WinUtilRestorePoint.ps1 index ad80be9673..79618a12e5 100644 --- a/functions/private/Set-WinUtilRestorePoint.ps1 +++ b/functions/private/Set-WinUtilRestorePoint.ps1 @@ -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" } diff --git a/functions/private/Set-WinUtilScheduledTask.ps1 b/functions/private/Set-WinUtilScheduledTask.ps1 index d9d5262aec..453f779309 100644 --- a/functions/private/Set-WinUtilScheduledTask.ps1 +++ b/functions/private/Set-WinUtilScheduledTask.ps1 @@ -40,6 +40,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 } } \ No newline at end of file diff --git a/functions/private/Set-WinUtilService.ps1 b/functions/private/Set-WinUtilService.ps1 index da237d639e..e16b2597f4 100644 --- a/functions/private/Set-WinUtilService.ps1 +++ b/functions/private/Set-WinUtilService.ps1 @@ -20,10 +20,10 @@ Function Set-WinUtilService { ) 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 } @@ -34,5 +34,5 @@ Function Set-WinUtilService { Write-Warning "Unable to set $Name due to unhandled exception" Write-Warning $_.Exception.Message } - + } diff --git a/functions/private/Set-WinUtilUiTheme.ps1 b/functions/private/Set-WinUtilUiTheme.ps1 index 22526bf206..46d55afa07 100644 --- a/functions/private/Set-WinUtilUiTheme.ps1 +++ b/functions/private/Set-WinUtilUiTheme.ps1 @@ -46,7 +46,7 @@ function Set-WinUtilUITheme { } catch { Write-Warning "Unable to apply theme" - Write-Warning $psitem.Exception.StackTrace + Write-Warning $psitem.Exception.StackTrace } return $inputXML; diff --git a/functions/public/Invoke-WPFButton.ps1 b/functions/public/Invoke-WPFButton.ps1 index b25d1531f0..01bb9fcd65 100644 --- a/functions/public/Invoke-WPFButton.ps1 +++ b/functions/public/Invoke-WPFButton.ps1 @@ -9,8 +9,8 @@ function Invoke-WPFButton { The name of the button that was 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") diff --git a/functions/public/Invoke-WPFFeatureInstall.ps1 b/functions/public/Invoke-WPFFeatureInstall.ps1 index 091a88a007..2277b75377 100644 --- a/functions/public/Invoke-WPFFeatureInstall.ps1 +++ b/functions/public/Invoke-WPFFeatureInstall.ps1 @@ -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) } } \ No newline at end of file diff --git a/functions/public/Invoke-WPFGetInstalled.ps1 b/functions/public/Invoke-WPFGetInstalled.ps1 index 3765abfb0b..001cce2bbb 100644 --- a/functions/public/Invoke-WPFGetInstalled.ps1 +++ b/functions/public/Invoke-WPFGetInstalled.ps1 @@ -34,9 +34,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 diff --git a/functions/public/Invoke-WPFImpex.ps1 b/functions/public/Invoke-WPFImpex.ps1 index 29675b2008..f02de2ed24 100644 --- a/functions/public/Invoke-WPFImpex.ps1 +++ b/functions/public/Invoke-WPFImpex.ps1 @@ -23,7 +23,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') @@ -33,7 +33,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 diff --git a/functions/public/Invoke-WPFInstall.ps1 b/functions/public/Invoke-WPFInstall.ps1 index f8b87bd7ca..89dd0b4940 100644 --- a/functions/public/Invoke-WPFInstall.ps1 +++ b/functions/public/Invoke-WPFInstall.ps1 @@ -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 "===========================================" diff --git a/functions/public/Invoke-WPFRunspace.ps1 b/functions/public/Invoke-WPFRunspace.ps1 index 9d16dac8f4..975f44a78c 100644 --- a/functions/public/Invoke-WPFRunspace.ps1 +++ b/functions/public/Invoke-WPFRunspace.ps1 @@ -22,7 +22,7 @@ function Invoke-WPFRunspace { Param ( $ScriptBlock, $ArgumentList - ) + ) # Create a PowerShell instance $script:powershell = [powershell]::Create() @@ -31,7 +31,7 @@ function Invoke-WPFRunspace { $script:powershell.AddScript($ScriptBlock) $script:powershell.AddArgument($ArgumentList) $script:powershell.RunspacePool = $sync.runspace - + # Execute the RunspacePool $script:handle = $script:powershell.BeginInvoke() diff --git a/functions/public/Invoke-WPFShortcut.ps1 b/functions/public/Invoke-WPFShortcut.ps1 index 7015725ac4..75c3155a6c 100644 --- a/functions/public/Invoke-WPFShortcut.ps1 +++ b/functions/public/Invoke-WPFShortcut.ps1 @@ -12,7 +12,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'" @@ -31,6 +31,6 @@ function Invoke-WPFShortcut { $Shortcut.TargetPath = $SourceExe $Shortcut.Arguments = $ArgumentsToSourceExe $Shortcut.Save() - + Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName)" } \ No newline at end of file diff --git a/functions/public/Invoke-WPFTab.ps1 b/functions/public/Invoke-WPFTab.ps1 index 3e6310a5a3..14d26c5e30 100644 --- a/functions/public/Invoke-WPFTab.ps1 +++ b/functions/public/Invoke-WPFTab.ps1 @@ -16,7 +16,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 } diff --git a/functions/public/Invoke-WPFToggle.ps1 b/functions/public/Invoke-WPFToggle.ps1 index 23e26f28f0..1ab6de6bb8 100644 --- a/functions/public/Invoke-WPFToggle.ps1 +++ b/functions/public/Invoke-WPFToggle.ps1 @@ -9,8 +9,8 @@ function Invoke-WPFToggle { The name of the toggle to invoke #> - - 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") diff --git a/functions/public/Invoke-WPFUltimatePerformance.ps1 b/functions/public/Invoke-WPFUltimatePerformance.ps1 index 15c4df16b0..14eca69abe 100644 --- a/functions/public/Invoke-WPFUltimatePerformance.ps1 +++ b/functions/public/Invoke-WPFUltimatePerformance.ps1 @@ -33,7 +33,7 @@ Function Invoke-WPFUltimatePerformance { } else { Write-Host "Power scheme '$powerSchemeName' already exists." - } + } } elseif($state -eq "Disabled"){ # Define the name of the power scheme @@ -52,10 +52,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 { @@ -67,7 +67,7 @@ Function Invoke-WPFUltimatePerformance { } } - + } Catch{ Write-Warning $psitem.Exception.Message diff --git a/functions/public/Invoke-WPFUnInstall.ps1 b/functions/public/Invoke-WPFUnInstall.ps1 index 5ab2292094..81cfc57c3e 100644 --- a/functions/public/Invoke-WPFUnInstall.ps1 +++ b/functions/public/Invoke-WPFUnInstall.ps1 @@ -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 "===========================================" diff --git a/functions/public/Invoke-WPFundoall.ps1 b/functions/public/Invoke-WPFundoall.ps1 index 354a26db4d..76eff6cce5 100644 --- a/functions/public/Invoke-WPFundoall.ps1 +++ b/functions/public/Invoke-WPFundoall.ps1 @@ -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) diff --git a/lint/PSScriptAnalyser.ps1 b/lint/PSScriptAnalyser.ps1 index 129f35de26..20a9080f43 100644 --- a/lint/PSScriptAnalyser.ps1 +++ b/lint/PSScriptAnalyser.ps1 @@ -15,7 +15,7 @@ 'PSShouldProcess', 'PSUseApprovedVerbs', 'PSUseDeclaredVarsMoreThanAssignments') -#> +#> # Do not analyze the following rules. Use ExcludeRules when you have # commented out the IncludeRules settings above and want to include all # the default rules except for those you exclude below. diff --git a/ooshutup10_winutil_settings.cfg b/ooshutup10_winutil_settings.cfg index 7882d7f926..caab9babf7 100644 --- a/ooshutup10_winutil_settings.cfg +++ b/ooshutup10_winutil_settings.cfg @@ -1,14 +1,14 @@ ############################################################################ # This file was created with O&O ShutUp10++ V1.9.1435 -# and can be imported onto another computer. +# and can be imported onto another computer. # # Download the application at https://www.oo-software.com/shutup10 -# You can then import the file from within the program. +# You can then import the file from within the program. # # Alternatively you can import it automatically over a command line. -# Simply use the following parameter: +# Simply use the following parameter: # OOSU10.exe -# +# # Selecting the Option /quiet ends the app right after the import and the # user does not get any feedback about the import. # diff --git a/pester/configs.Tests.ps1 b/pester/configs.Tests.ps1 index fa69f6777d..06d560c901 100644 --- a/pester/configs.Tests.ps1 +++ b/pester/configs.Tests.ps1 @@ -10,14 +10,14 @@ Get-ChildItem .\config | Where-Object {$_.Extension -eq ".json"} | ForEach-Objec #=========================================================================== Describe "Config Files" -ForEach @( - @{ + @{ name = "applications" config = $('{ "winget": "value", "choco": "value" }' | ConvertFrom-Json) }, - @{ + @{ name = "tweaks" undo = $true } @@ -37,7 +37,7 @@ Describe "Config Files" -ForEach @( $result.Add($application) } } - + $result | Select-String "WPF*" | should -BeNullOrEmpty } } @@ -48,16 +48,16 @@ Describe "Config Files" -ForEach @( foreach ($tweak in $tweaks){ $Originals = @( - @{ - name = "registry" + @{ + name = "registry" value = "OriginalValue" }, - @{ - name = "service" + @{ + name = "service" value = "OriginalType" - }, - @{ - name = "ScheduledTask" + }, + @{ + name = "ScheduledTask" value = "OriginalState" } ) diff --git a/pester/functions.Tests.ps1 b/pester/functions.Tests.ps1 index 093abfe2db..02c8fcce1c 100644 --- a/pester/functions.Tests.ps1 +++ b/pester/functions.Tests.ps1 @@ -3,14 +3,14 @@ #=========================================================================== Describe "Functions"{ - + Get-ChildItem .\functions -Recurse -File | ForEach-Object { context "$($psitem.BaseName)" { BeforeEach -Scriptblock { . $fullname } - + It "Imports with no errors" -TestCases @{ basename = $($psitem.BaseName) fullname = $psitem.FullName diff --git a/pester/winutil.Tests.ps1 b/pester/winutil.Tests.ps1 index 0283b61ee6..1077c1f164 100644 --- a/pester/winutil.Tests.ps1 +++ b/pester/winutil.Tests.ps1 @@ -4,7 +4,7 @@ $script = Get-Content .\winutil.ps1 # Remove the part of the script that shows the form, leaving only the variable and function declarations -$script[0..($script.count - 21)] | Out-File .\pester.ps1 +$script[0..($script.count - 21)] | Out-File .\pester.ps1 BeforeAll { @@ -23,5 +23,5 @@ Describe "GUI" { It "Imports with no errors" { $sync.Form | should -Not -BeNullOrEmpty } - } + } } diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 39f1b0c718..e9192e37fa 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -37,7 +37,7 @@ $sync.runspace.Open() WingetFailedInstall($Message) : base($Message) {} } - + class ChocoFailedInstall : Exception { [string] $additionalData @@ -49,7 +49,7 @@ $sync.runspace.Open() GenericException($Message) : base($Message) {} } - + $inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^ - + +