Test Merge - Multiple Fixes (#317)

* clean up

* Update runspace.ps1 for new tweaks (#291)

* clean up (#290)

* Update Tweaks

Co-authored-by: Chris Titus <dfm.titus@gmail.com>

* Github actions to update script based on branch (#294)

* clean up (#290)

* Update Tweaks

* test pipeline

* test pipeline

* chore: autopublish 2022-10-19T09:34:35Z

* test pipeline

* test pipeline

* chore: autopublish 2022-10-19T11:39:50Z

* test pipeline

* test pipeline

* test pipeline

* test pipeline

* test pipeline

* test pipeline

* test

* please work

* Update Branch in script

* test new variable

* Update Branch in script

* test all branches

* updated $BranchToUse to use the correct casing

Co-authored-by: Chris Titus <dfm.titus@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: DeveloperDurp <DeveloperDurp@users.noreply.github.com>

* bring test up to date (#295)

* clean up (#290)

* Update README.md

* Update README.md

* Update README.md

* Update release.yaml

* Replace Broken Issue Links in KnownIssues.md (#297)

- The issues listed in KnownIssues.md were broken due to the issues tab in the previous repo being removed.
  - Replaced with issues in this repo that apply to the issues, if there were any
- I think this issue could be applied to the main branch without worry, but I'll leave that up to you.

* Update Branch in script

* Implement check for local ooshutup10.cfg file (#298)

- Checks for an ooshutup10.cfg file in the current directory and uses it if found
  - This allows users to use custom config files if they wish

* bring winget install script (#302)

* clean up (#290)

* Update README.md

* Update README.md

* Update README.md

* Update winget.ps1

* Update Branch in script

* Brave Fix

* Fix Flickering

New Windows versions HATE timeout tweaks

* Fixing Error Messages

* syntax fix

* Switch to PSGallery winget-installer

* Adding Branch Variables from #309

Co-authored-by: DeveloperDurp <developerdurp@durp.info>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: DeveloperDurp <DeveloperDurp@users.noreply.github.com>
Co-authored-by: Carter <60557606+Carterpersall@users.noreply.github.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
This commit is contained in:
Chris Titus 2022-10-23 00:12:07 -05:00 committed by GitHub
parent fc437e8c4c
commit bf227887f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1378 additions and 1310 deletions

21
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Update Branch
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Create local changes
run: |
sed -i "/\$BranchToUse = /c\$BranchToUse = '$GITHUB_REF_NAME'" $GITHUB_WORKSPACE/runspace.ps1
cat $GITHUB_WORKSPACE/runspace.ps1
sed -i "/\$BranchToUse = /c\$BranchToUse = '$GITHUB_REF_NAME'" $GITHUB_WORKSPACE/runspace.ps1
cat $GITHUB_WORKSPACE/winutil.ps1
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update Branch in script

View File

@ -1,6 +1,6 @@
## Known Issues and Fixes
- [#333](https://github.com/ChrisTitusTech/win10script/issues/333) Windows taking longer to shut down:
- Turn on fast startup: Press Windows key + R, then type:
- Windows taking longer to shut down:
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) Turn on fast startup: Press Windows key + R, then type:
```
control /name Microsoft.PowerOptions /page pageGlobalSettings
```
@ -8,20 +8,20 @@
```
powercfg /H off
```
- [#253](https://github.com/ChrisTitusTech/win10script/issues/253) Windows Search does not work: Enable Background Apps
- [#278](https://github.com/ChrisTitusTech/win10script/issues/278) Xbox Game Bar Activation Broken: Set the Xbox Accessory Management Service to Automatic
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) [95](https://github.com/ChrisTitusTech/winutil/issues/95) [#232](https://github.com/ChrisTitusTech/winutil/issues/232) Windows Search does not work: Enable Background Apps
- [#198](https://github.com/ChrisTitusTech/winutil/issues/198) Xbox Game Bar Activation Broken: Set the Xbox Accessory Management Service to Automatic
```
Get-Service -Name "XboxGipSvc" | Set-Service -StartupType Automatic
```
- [#250](https://github.com/ChrisTitusTech/win10script/issues/250) Windows Insider Builds not installing: Telemetry needs to be enabled
- Windows Insider Builds not installing: Telemetry needs to be enabled
```
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
```
- [#245](https://github.com/ChrisTitusTech/win10script/issues/245) winget requires interaction on first run: Manually type 'y' and 'enter' into the PowerShell console to continue
- [#237](https://github.com/ChrisTitusTech/win10script/issues/237) (Windows 11) Quick Settings no longer works: Launch the Script and click 'Enable Action Center'
- [#214](https://github.com/ChrisTitusTech/win10script/issues/214) [#165](https://github.com/ChrisTitusTech/win10script/issues/165) [#150](https://github.com/ChrisTitusTech/win10script/issues/150) Explorer no longer launches: Go to Control Panel, File Explorer Options, Change the 'Open File Explorer to' option to 'This PC'.
- [#199](https://github.com/ChrisTitusTech/win10script/issues/199) [#216](https://github.com/ChrisTitusTech/win10script/issues/216) [#233](https://github.com/ChrisTitusTech/win10script/issues/233) [#242](https://github.com/ChrisTitusTech/win10script/issues/242) [#208](https://github.com/ChrisTitusTech/win10script/issues/208) Script doesn't run/PowerShell crashes:
- Winget requires interaction on first run: Manually type 'y' and 'enter' into the PowerShell console to continue
- (Windows 11) Quick Settings no longer works: Launch the Script and click 'Enable Action Center'
- Explorer no longer launches: Go to Control Panel, File Explorer Options, Change the 'Open File Explorer to' option to 'This PC'.
- Script doesn't run/PowerShell crashes:
1. Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11)
2. Run:
```

View File

@ -1094,5 +1094,56 @@
}
Set-ItemProperty -Path \"HKU:\\.DEFAULT\\Control Panel\\Keyboard\" -Name \"InitialKeyboardIndicators\" -Type DWord -Value 2"
]
},
"EssTweaksRemoveEdge": {
"InvokeScript": [
"Invoke-WebRequest -useb https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/Edge_Removal.bat | Invoke-Expression"
]
},
"MiscTweaksDisableNotifications": {
"InvokeScript": [
"New-Item -Path \"HKCU:\\Software\\Policies\\Microsoft\\Windows\" -Name \"Explorer\" -force
New-ItemProperty -Path \"HKCU:\\Software\\Policies\\Microsoft\\Windows\\Explorer\" -Name \"DisableNotificationCenter\" -PropertyType \"DWord\" -Value 1
New-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\PushNotifications\" -Name \"ToastEnabled\" -PropertyType \"DWord\" -Value 0 -force"
]
},
"MiscTweaksRightClickMenu": {
"InvokeScript": [
"New-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Name \"InprocServer32\" -force -value \"\" "
]
},
"EssTweaksDiskCleanup": {
"InvokeScript": [
"cleanmgr.exe /d C: /VERYLOWDISK"
]
},
"MiscTweaksDisableTPMCheck": {
"InvokeScript": [
"If (!(Test-Path \"HKLM:\\SYSTEM\\Setup\\MoSetup\")) {
New-Item -Path \"HKLM:\\SYSTEM\\Setup\\MoSetup\" -Force | Out-Null
}
Set-ItemProperty -Path \"HKLM:\\SYSTEM\\Setup\\MoSetup\" -Name \"AllowUpgradesWithUnsupportedTPM\" -Type DWord -Value 1"
]
},
"MiscTweaksDisableUAC": {
"InvokeScript": [
"# This below is the pussy mode which can break some apps. Please. Leave this on 1.
# below i will show a way to do it without breaking some Apps that check UAC. U need to be admin tho.
# Set-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\" -Name \"EnableLUA\" -Type DWord -Value 0
Set-ItemProperty -Path HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -Name ConsentPromptBehaviorAdmin -Type DWord -Value 0 # Default is 5
# This will set the GPO Entry in Security so that Admin users elevate without any prompt while normal users still elevate and u can even leave it ennabled.
# It will just not bother u anymore"
]
},
"EssTweaksDeleteTempFiles": {
"InvokeScript": [
"Get-ChildItem -Path \"C:\\Windows\\Temp\" *.* -Recurse | Remove-Item -Force -Recurse
Get-ChildItem -Path $env:TEMP *.* -Recurse | Remove-Item -Force -Recurse"
]
},
"EssTweaksRemoveCortana": {
"InvokeScript": [
"Get-AppxPackage -allusers Microsoft.549981C3F5F10 | Remove-AppxPackage"
]
}
}

View File

@ -1,11 +1,15 @@
#for CI/CD
$BranchToUse = 'test'
<#
.NOTES
Author : @ChrisTitusTech
Runspace Author : @DeveloperDurp
Version 0.1
Author : @ChrisTitusTech
Runspace Author : @DeveloperDurp
Version 0.1
#>
#region Variables
$sync = [Hashtable]::Synchronized(@{})
$sync.logfile = "$env:TEMP\winutil.log"
@ -20,11 +24,11 @@ Version 0.1
#region Functions
#===========================================================================
# Button clicks
#===========================================================================
#===========================================================================
# Button clicks
#===========================================================================
function Invoke-Button {
function Invoke-Button {
<#
@ -55,9 +59,9 @@ Version 0.1
"Paneluser" {cmd /c "control userpasswords2"}
"Updates*" {Invoke-command $sync.GUIUpdates -ArgumentList "$button"}
}
}
}
function uncheckall {
function uncheckall {
<#
@ -92,9 +96,9 @@ Version 0.1
}
if($output){Write-Output $output.Substring(1)}
}
}
function Invoke-Runspace {
function Invoke-Runspace {
<#
@ -123,13 +127,13 @@ Version 0.1
$Script.Runspace = $runspace
$Script.BeginInvoke()
}
}
#===========================================================================
# Navigation Controls
#===========================================================================
#===========================================================================
# Navigation Controls
#===========================================================================
function switchtab {
function switchtab {
<#
@ -146,9 +150,9 @@ Version 0.1
if ($x -eq $psitem){$sync["TabNav"].Items[$psitem].IsSelected = $true}
else{$sync["TabNav"].Items[$psitem].IsSelected = $false}
}
}
}
Function Tweak-Buttons {
Function Tweak-Buttons {
<#
@ -164,7 +168,7 @@ Version 0.1
if ($preset -contains $psitem ){$sync["$psitem"].IsChecked = $True}
Else{$sync["$psitem"].IsChecked = $false}
}
}
}
#endregion Functions
@ -174,11 +178,11 @@ Version 0.1
#region Scripts
#===========================================================================
# Generic Scripts
#===========================================================================
#===========================================================================
# Generic Scripts
#===========================================================================
$sync.WriteLogs = {
$sync.WriteLogs = {
<#
@ -213,21 +217,21 @@ Version 0.1
return
}
Write-Verbose "$date $delimiter $Level $delimiter $message"
}
}
#===========================================================================
# Install Tab
#===========================================================================
#===========================================================================
# Install Tab
#===========================================================================
<#
<#
This section is working as expected and logs output to console and $ENV:Temp\winutil.log
TODO: Error Handling with winget. Currently it does not handle errors as expected.
#>
#>
$Sync.GUIInstallPrograms = {
$Sync.GUIInstallPrograms = {
<#
@ -284,7 +288,6 @@ Version 0.1
return
}
#Invoke a runspace so that the GUI does not lock up
$sync.taskrunning = $true
@ -296,12 +299,11 @@ Version 0.1
}
Invoke-Runspace @params
}
}
$sync.ScriptsInstallPrograms = {
$sync.ScriptsInstallPrograms = {
<#
.DESCRIPTION
This scriptblock will detect if winget is installed and if not attempt to install it. Once ready it will then either upgrade any installs or attempt to install any applications provided.
@ -435,21 +437,21 @@ Version 0.1
$sync.taskrunning = $false
[System.Windows.MessageBox]::Show("All applications have been installed",'Installs are done!',"OK","Info")
}
}
}
#===========================================================================
# Tab 2 - Tweaks Buttons
#===========================================================================
#===========================================================================
# Tab 2 - Tweaks Buttons
#===========================================================================
<#
<#
This section is working as expected and logs output to console and $ENV:Temp\winutil.log
TODO: Error Handling as Try blocks and -erroraction stop causes runspace to lock up
#>
#>
$Sync.GUITweaks = {
$Sync.GUITweaks = {
<#
@ -492,9 +494,9 @@ Version 0.1
Invoke-Runspace @params
}
}
$Sync.ScriptTweaks = {
$Sync.ScriptTweaks = {
<#
@ -569,13 +571,10 @@ Version 0.1
Write-Logs -Level INFO -Message "Starting Services Modification" -LogPath $sync.logfile
$ServicesToModify | ForEach-Object {
$service = Get-Service -Name W32Time -ErrorAction SilentlyContinue
if ($service.Length -gt 0) {
Stop-Service "$($psitem.name)"
Set-Service "$($psitem.name)" -StartupType $($psitem.StartupType)
Write-Logs -Level INFO -Message "Service $($psitem.name) set to $($psitem.StartupType)" -LogPath $sync.logfile
}
}
Write-Logs -Level INFO -Message "Finished setting Services" -LogPath $sync.logfile
}
@ -584,8 +583,6 @@ Version 0.1
Write-Logs -Level INFO -Message "Starting ScheduledTask Modification" -LogPath $sync.logfile
$ScheduledTaskToModify | ForEach-Object {
Get-ScheduledTask -TaskName "$($psitem.name)" -ErrorAction SilentlyContinue -OutVariable checktask
if ($checktask) {
Try{
if($($psitem.State) -eq "Disabled"){
Disable-ScheduledTask -TaskName "$($psitem.name)" -ErrorAction Stop | Out-Null
@ -596,7 +593,6 @@ Version 0.1
Write-Logs -Level INFO -Message "Scheduled Task $($psitem.name) set to $($psitem.State)" -LogPath $sync.logfile
}Catch{Write-Logs -Level ERROR -Message "Unable to set Scheduled Task $($psitem.name) set to $($psitem.State)" -LogPath $sync.logfile}
}
}
Write-Logs -Level INFO -Message "Finished setting ScheduledTasks" -LogPath $sync.logfile
}
@ -624,23 +620,24 @@ Version 0.1
Start-Process $PSHOME\powershell.exe -Verb runas -ArgumentList "-Command $scriptblock" -Wait
}
Write-Logs -Level INFO -Message "Finished Scripts" -LogPath $sync.logfile
}
#
# Fix bad tweaks made from previous versions
#
Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name "ClearPageFileAtShutdown" -Type DWord -Value 0
Write-Logs -Level INFO -Message "Finished Scripts" -LogPath $sync.logfile
}
Write-Logs -Level INFO -Message "Tweaks finished" -LogPath $sync.logfile
if($sync["Form"]){
$sync.taskrunning = $false
[System.Windows.MessageBox]::Show("All modifications have finished",'Tweaks are done!',"OK","Info")
}
}
}
$Sync.GUIUndoTweaks = {
$Sync.GUIUndoTweaks = {
<#
@ -665,9 +662,9 @@ Version 0.1
#Invoke a runspace so that the GUI does not lock up
Invoke-Runspace $sync.ScriptUndoTweaks
}
}
$sync.ScriptUndoTweaks = {
$sync.ScriptUndoTweaks = {
<#
@ -772,21 +769,21 @@ Version 0.1
$sync.taskrunning = $false
[System.Windows.MessageBox]::Show("All tweaks have been removed",'Undo is done!',"OK","Info")
}
}
}
#===========================================================================
# Tab 3 - Config Buttons
#===========================================================================
#===========================================================================
# Tab 3 - Config Buttons
#===========================================================================
<#
<#
This section is working as expected and logs output to console and $ENV:Temp\winutil.log
TODO: Error Handling as Try blocks and -erroraction stop causes runspace to lock up
#>
#>
$Sync.GUIFeatures = {
$Sync.GUIFeatures = {
<#
@ -829,9 +826,9 @@ Version 0.1
Invoke-Runspace @params
}
}
$sync.ScriptFeatureInstall = {
$sync.ScriptFeatureInstall = {
<#
@ -881,13 +878,13 @@ Version 0.1
[System.Windows.MessageBox]::Show("Features have been installed",'Installs are done!',"OK","Info")
}
}
}
#===========================================================================
# Tab 4 - Updates Buttons
#===========================================================================
#===========================================================================
# Tab 4 - Updates Buttons
#===========================================================================
$Sync.GUIUpdates = {
$Sync.GUIUpdates = {
<#
@ -925,9 +922,9 @@ Version 0.1
Invoke-Runspace @params
}
}
$sync.ScriptUpdates = {
$sync.ScriptUpdates = {
<#
@ -1251,7 +1248,7 @@ Version 0.1
[System.Windows.MessageBox]::Show("Updates have been configured",'Configuration is done!',"OK","Info")
}
}
}
#endregion Scripts
@ -1266,27 +1263,27 @@ Invoke-Runspace -ScriptBlock {$sync.ComputerInfo = Get-ComputerInfo} | Out-Null
#region form
#WinForms dependancies
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName PresentationFramework
[System.Windows.Forms.Application]::EnableVisualStyles()
#WinForms dependancies
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName PresentationFramework
[System.Windows.Forms.Application]::EnableVisualStyles()
#List of config files to import
$configs = (
#List of config files to import
$configs = (
"applications",
"tweaks",
"preset",
"feature"
)
)
#Test for admin credentials
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
#Test for admin credentials
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
$IsAdmin = $false
}
}
#To use local files run $env:environment = "dev" before starting the ps1 file
if($env:environment -eq "dev"){
#To use local files run $env:environment = "dev" before starting the ps1 file
if($env:environment -eq "dev"){
if($IsAdmin -eq $false){
[System.Windows.MessageBox]::Show("This application needs to be run as Admin",'Administrative privileges required',"OK","Info")
@ -1294,21 +1291,22 @@ Invoke-Runspace -ScriptBlock {$sync.ComputerInfo = Get-ComputerInfo} | Out-Null
}
$confirm = [System.Windows.MessageBox]::Show('$ENV:Evnronment is set to dev. Do you wish to load the dev environment?','Dev Environment tag detected',"YesNo","Info")
}
}
if($confirm -eq "yes"){
if($confirm -eq "yes"){
$inputXML = Get-Content "MainWindow.xaml"
$configs | ForEach-Object {
$sync["$PSItem"] = Get-Content .\config\$PSItem.json | ConvertFrom-Json
}
}
else{
}
else{
#Select the working branch
if($env:branch){
$branch = $env:branch
}
Else {$branch = "main"}
Else {$branch = $BranchToUse}
if($IsAdmin -eq $false){
Write-Output "This application needs to be run as an administrator. Attempting relaunch"
@ -1320,7 +1318,7 @@ Invoke-Runspace -ScriptBlock {$sync.ComputerInfo = Get-ComputerInfo} | Out-Null
$configs | ForEach-Object {
$sync["$psitem"] = Invoke-RestMethod "https://raw.githubusercontent.com/ChrisTitusTech/winutil/$branch/config/$psitem.json"
}
}
}
#endregion form
@ -1346,26 +1344,26 @@ write-host "====Chris Titus Tech====="
write-host "=====Windows Toolbox====="
if($gui -eq $true){
$inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window'
[xml]$XAML = $inputXML
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
$inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window'
[xml]$XAML = $inputXML
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
try{$sync["Form"]=[Windows.Markup.XamlReader]::Load( $reader )}
catch [System.Management.Automation.MethodInvocationException] {
try{$sync["Form"]=[Windows.Markup.XamlReader]::Load( $reader )}
catch [System.Management.Automation.MethodInvocationException] {
Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..."
write-host $error[0].Exception.Message -ForegroundColor Red
if ($error[0].Exception.Message -like "*button*"){
write-warning "Ensure your &lt;button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"}
}
catch{#if it broke some other way <img draggable="false" role="img" class="emoji" alt="😀" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg">
}
catch{#if it broke some other way <img draggable="false" role="img" class="emoji" alt="😀" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg">
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
}
}
# Store Form Objects In PowerShell
$xaml.SelectNodes("//*[@Name]") | ForEach-Object {$sync["$("$($psitem.Name)")"] = $sync["Form"].FindName($psitem.Name)}
# Store Form Objects In PowerShell
$xaml.SelectNodes("//*[@Name]") | ForEach-Object {$sync["$("$($psitem.Name)")"] = $sync["Form"].FindName($psitem.Name)}
#Gives every button the invoke-button function
$sync.keys | ForEach-Object {
#Gives every button the invoke-button function
$sync.keys | ForEach-Object {
if($sync.$psitem){
if($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "Button"){
$sync["$psitem"].Add_Click({
@ -1374,18 +1372,18 @@ if($gui -eq $true){
})
}
}
}
}
$sync["Form"].ShowDialog() | out-null
$sync["Form"].ShowDialog() | out-null
}
<#
How to run Arguments
How to run Arguments
First step is to set the $env:args variable with the setups you wish to do. To do multiple items put a " " space between each command.
For commands that require input seperate the command with a semicolon ":" and provide the values to pass to that argument seperated by a comma ",". (IE: Install:git.git,windirstat.windirstat)
First step is to set the $env:args variable with the setups you wish to do. To do multiple items put a " " space between each command.
For commands that require input seperate the command with a semicolon ":" and provide the values to pass to that argument seperated by a comma ",". (IE: Install:git.git,windirstat.windirstat)
Supported arguments:
Supported arguments:
InstallUpgrade
UndoTweaks
@ -1404,7 +1402,7 @@ if($gui -eq $true){
Tweaks:value1,values2,...
- Values should be what you find inside the tweaks.json file
Example usage:
Example usage:
$env:args = "Install:git.git,WinDirStat.WinDirStat "; iwr -useb https://christitus.com/win | iex
@ -1417,29 +1415,30 @@ if($gui -eq $true){
#>
If($env:args){
Write-Verbose "Arguments Detected, Running Args"
If($env:args -match '\bInstallUpgrade\b'){Invoke-command $sync.ScriptsInstallPrograms -ArgumentList "Upgrade"}
If($env:args -match '\bUndoTweaks\b'){Invoke-command $sync.ScriptUndoTweaks}
If($env:args -match '\bPanelControl\b'){cmd /c control}
If($env:args -match '\bPanelNetwork\b'){cmd /c ncpa.cpl}
If($env:args -match '\bPanelPower\b'){cmd /c powercfg.cpl}
If($env:args -match '\bPanelSound\b'){cmd /c mmsys.cpl}
If($env:args -match '\bPanelSystem\b'){cmd /c sysdm.cpl}
If($env:args -match '\bPanelUser\b'){cmd /c "control userpasswords2"}
If($env:args -match '\bDefaultUpdates\b'){Invoke-command $sync.ScriptUpdates -ArgumentList "Updatesdefault"}
If($env:args -match '\bDisableUpdates\b'){Invoke-command $sync.ScriptUpdates -ArgumentList "Updatesdisable"}
If($env:args -match '\bEnableSecurity\b'){Invoke-command $sync.ScriptUpdates -ArgumentList "Updatessecurity"}
If($env:args -match '\bQuitAfter\b'){Break}
If($env:args -match '\bInstall\b'){
Write-Verbose "Arguments Detected, Running Args"
If($env:args -match '\bInstallUpgrade\b'){Invoke-command $sync.ScriptsInstallPrograms -ArgumentList "Upgrade"}
If($env:args -match '\bUndoTweaks\b'){Invoke-command $sync.ScriptUndoTweaks}
If($env:args -match '\bPanelControl\b'){cmd /c control}
If($env:args -match '\bPanelNetwork\b'){cmd /c ncpa.cpl}
If($env:args -match '\bPanelPower\b'){cmd /c powercfg.cpl}
If($env:args -match '\bPanelSound\b'){cmd /c mmsys.cpl}
If($env:args -match '\bPanelSystem\b'){cmd /c sysdm.cpl}
If($env:args -match '\bPanelUser\b'){cmd /c "control userpasswords2"}
If($env:args -match '\bDefaultUpdates\b'){Invoke-command $sync.ScriptUpdates -ArgumentList "Updatesdefault"}
If($env:args -match '\bDisableUpdates\b'){Invoke-command $sync.ScriptUpdates -ArgumentList "Updatesdisable"}
If($env:args -match '\bEnableSecurity\b'){Invoke-command $sync.ScriptUpdates -ArgumentList "Updatessecurity"}
If($env:args -match '\bQuitAfter\b'){Break}
If($env:args -match '\bInstall\b'){
$ProgramstoInstall = (($env:args-split " " | Where-Object {$_ -like "install*"} ) -split ":")[1]
Write-Verbose "Installing $ProgramstoInstall."
Invoke-command $sync.ScriptsInstallPrograms -ArgumentList "$ProgramstoInstall"
}
If($env:args -match '\bTweaks\b'){
}
If($env:args -match '\bTweaks\b'){
$Tweakstorun = (($env:args-split " " | Where-Object {$_ -like "Tweaks*"} ) -split ":")[1]
Write-Verbose "Running the following tweaks $Tweakstorun."
Invoke-command $sync.ScriptTweaks -ArgumentList "$Tweakstorun"
}
}
}
Write-Host "Thank you for using winutil!"

View File

@ -1,3 +1,5 @@
#for CI/CD
$BranchToUse = 'test'
<#
.NOTES
Author : Chris Titus @christitustech
@ -5,8 +7,7 @@
Version 0.0.1
#>
#$inputXML = Get-Content "MainWindow.xaml" #uncomment for development
$inputXML = (new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/MainWindow.xaml") #uncomment for Production
$inputXML = (new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/ChrisTitusTech/winutil/$BranchToUse/MainWindow.xaml") #uncomment for Production
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
@ -132,7 +133,7 @@ $WPFinstall.Add_Click({
$WPFInstallautohotkey.IsChecked = $false
}
If ( $WPFInstallbrave.IsChecked -eq $true ) {
$wingetinstall.Add("BraveSoftware.BraveBrowser")
$wingetinstall.Add("Brave.Brave")
$WPFInstallbrave.IsChecked = $false
}
If ( $WPFInstallchrome.IsChecked -eq $true ) {
@ -545,33 +546,25 @@ $WPFinstall.Add_Click({
Write-Host "Winget Already Installed"
}
else {
if (((((Get-ComputerInfo).OSName.IndexOf("LTSC")) -ne -1) -or ((Get-ComputerInfo).OSName.IndexOf("Server") -ne -1)) -and (((Get-ComputerInfo).WindowsVersion) -ge "1809")) {
#Checks if Windows edition is LTSC/Server 2019+
#Manually Installing Winget
#Gets the computer's information
$ComputerInfo = Get-ComputerInfo
#Gets the Windows Edition
$OSName = if ($ComputerInfo.OSName) {
$ComputerInfo.OSName
}else {
$ComputerInfo.WindowsProductName
}
if (((($OSName.IndexOf("LTSC")) -ne -1) -or ($OSName.IndexOf("Server") -ne -1)) -and (($ComputerInfo.WindowsVersion) -ge "1809")) {
Write-Host "Running Alternative Installer for LTSC/Server Editions"
#Download Needed Files
Write-Host "Downloading Needed Files..."
Start-BitsTransfer -Source "https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx" -Destination "$env:TEMP\Microsoft.VCLibs.x64.14.00.Desktop.appx"
Start-BitsTransfer -Source "https://github.com/microsoft/winget-cli/releases/download/v1.2.10271/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Destination "$env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
Start-BitsTransfer -Source "https://github.com/microsoft/winget-cli/releases/download/v1.2.10271/b0a0692da1034339b76dce1c298a1e42_License1.xml" -Destination "$env:TEMP\b0a0692da1034339b76dce1c298a1e42_License1.xml"
# Switching to winget-install from PSGallery from asheroto
# Source: https://github.com/asheroto/winget-installer
#Installing Packages
Write-Host "Installing Packages..."
Add-AppxProvisionedPackage -Online -PackagePath "$env:TEMP\Microsoft.VCLibs.x64.14.00.Desktop.appx" -SkipLicense
Add-AppxProvisionedPackage -Online -PackagePath "$env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -LicensePath "$env:TEMP\b0a0692da1034339b76dce1c298a1e42_License1.xml"
Write-Host "winget Installed (Reboot might be required before winget will work)"
Start-Process powershell.exe -Verb RunAs -ArgumentList "-command irm https://raw.githubusercontent.com/asheroto/winget-installer/master/winget-install.ps1 | iex | Out-Host" -WindowStyle Normal
#Sleep for 5 seconds to maximize chance that winget will work without reboot
Write-Host "Pausing for 5 seconds to maximize chance that winget will work without reboot"
Start-Sleep -s 5
#Removing no longer needed Files
Write-Host "Removing no longer needed Files..."
Remove-Item -Path "$env:TEMP\Microsoft.VCLibs.x64.14.00.Desktop.appx" -Force
Remove-Item -Path "$env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Force
Remove-Item -Path "$env:TEMP\b0a0692da1034339b76dce1c298a1e42_License1.xml" -Force
Write-Host "Removed Files that are no longer needed"
}
elseif (((Get-ComputerInfo).WindowsVersion) -lt "1809") {
#Checks if Windows Version is too old for winget
@ -755,15 +748,14 @@ $WPFtweaksbutton.Add_Click({
If ( $WPFEssTweaksDeleteTempFiles.IsChecked -eq $true ) {
Write-Host "Delete Temp Files"
Get-ChildItem -Path "C:\Windows\Temp" *.* -Recurse | Remove-Item -Force -Recurse
Get-ChildItem -Path $env:TEMP *.* -Recurse | Remove-Item -Force -Recurse
Get-ChildItem -Path "C:\Windows\Temp" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
Get-ChildItem -Path $env:TEMP *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
$WPFEssTweaksDeleteTempFiles.IsChecked = $false
Write-Host "================================="
Write-Host "--- !!!!ERRORS ARE NORMAL!!!! ---"
Write-Host "--- Cleaned following folders:---"
Write-Host "--- C:\Windows\Temp ---"
Write-Host "---"$env:TEMP"---"
Write-Host "================================="
Write-Host "======================================="
Write-Host "--- Cleaned following folders:"
Write-Host "--- C:\Windows\Temp"
Write-Host "--- "$env:TEMP
Write-Host "======================================="
}
If ( $WPFEssTweaksDVR.IsChecked -eq $true ) {
@ -775,6 +767,9 @@ $WPFtweaksbutton.Add_Click({
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_EFSEFeatureFlags" -Type DWord -Value 0
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 0
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_FSEBehavior" -Type DWord -Value 2
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR")) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Force
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowGameDVR" -Type DWord -Value 0
#Disabling Gamebar Presence Writer, which causes stutter in games
@ -844,9 +839,11 @@ $WPFtweaksbutton.Add_Click({
$WPFMiscTweaksRightClickMenu.IsChecked = $false
}
If ( $WPFEssTweaksOO.IsChecked -eq $true ) {
If (!(Test-Path .\ooshutup10.cfg)) {
Write-Host "Running O&O Shutup with Recommended Settings"
curl.exe -ss "https://raw.githubusercontent.com/ChrisTitusTech/win10script/master/ooshutup10.cfg" -o ooshutup10.cfg
curl.exe -ss "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -o OOSU10.exe
}
./OOSU10.exe ooshutup10.cfg /quiet
$WPFEssTweaksOO.IsChecked = $false
}
@ -952,7 +949,7 @@ $WPFtweaksbutton.Add_Click({
# -ErrorAction SilentlyContinue is so it doesn't write an error to stdout if a service doesn't exist
Write-Host "Setting $service StartupType to Manual"
Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Manual
Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Manual -ErrorAction SilentlyContinue
}
$WPFEssTweaksServices.IsChecked = $false
}
@ -1065,17 +1062,17 @@ $WPFtweaksbutton.Add_Click({
## Performance Tweaks and More Telemetry
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" -Name "SearchOrderConfig" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" -Name "SystemResponsiveness" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control" -Name "WaitToKillServiceTimeout" -Type DWord -Value 2000
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "WaitToKillAppTimeout" -Type DWord -Value 5000
Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -ErrorAction SilentlyContinue
# Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -Type DWord -Value 4000 # Note: This caused flickering
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "AutoEndTasks" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "LowLevelHooksTimeout" -Type DWord -Value 1000
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "WaitToKillServiceTimeout" -Type DWord -Value 2000
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name "ClearPageFileAtShutdown" -Type DWord -Value 0
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseHoverTime" -Type DWord -Value 10
## Timeout Tweaks cause flickering on Windows now
Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "WaitToKillAppTimeout" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control" -Name "WaitToKillServiceTimeout" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "LowLevelHooksTimeout" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "WaitToKillServiceTimeout" -ErrorAction SilentlyContinue
# Network Tweaks
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" -Name "IRPStackSize" -Type DWord -Value 20
@ -1197,7 +1194,7 @@ $WPFtweaksbutton.Add_Click({
}
If ( $WPFEssTweaksRemoveEdge.IsChecked -eq $true ) {
Write-Host "Removing Microsoft Edge..."
Invoke-WebRequest -useb https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/Edge_Removal.bat | Invoke-Expression
Invoke-WebRequest -useb https://raw.githubusercontent.com/ChrisTitusTech/winutil/$BranchToUse/Edge_Removal.bat | Invoke-Expression
$WPFEssTweaksRemoveEdge.IsChecked = $false
}
If ( $WPFEssTweaksDeBloat.IsChecked -eq $true ) {