mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-21 21:41:29 -06:00
2023 09 23 test (#1117)
* move restore point to runspace (#1056)
* Add Guilded into Communication Tab (#1059)
* Add Guilded into Communication Tab
* Remove Choco Package due to there is no Chocolatey packages
* : Add ZeroTier One to utilities menu (#1061)
* Update applications.json (#1063)
Update to add [SuperF4 - Stefan Sundin](https://stefansundin.github.io/superf4/), as mentioned in #374 [Choco - SuperF4](https://community.chocolatey.org/packages/superf4) maintained by Xav83. [WinGet - SuperF4](https://winstall.app/apps/StefanSundin.Superf4) SuperF4 and Winget package published by Stefan Sundin.
* Update inputXML.xaml (#1062)
Updated inputXML.xaml to account for addition of the SuperF4 software.
* Added AIMP music player (#1064)
* Add Ventoy (Chocolatey Only Package) & .NET Core Runtime (Winget & Chocolatey) (#1066)
* Tidy up SuperF4 line.
* Tidy up SuperF4 line.
Used spaces instead of tabs.
* Add dotnet 7.0.11 Desktop Runtime
* Undone changes to SuperF4 line
* Addition of Ventoy (chocolatey only) package
* Comment Spacing, Indentation, and Capitalization (#1084)
* Comment Spacing, Indentation, and Capitalization
* Comment Grammar and Spacing
Makes grammar in comments better and more consistent
Adds space before comment and centers word in `Write-Host` commands
* More Grammar and Formatting
* Add some comments
* Populate PlaceHolder comments in functions
Files I found that has issues:
Get-WinUtilRegistry.ps1
Install-WinUtilWinget.ps1
Invoke-WinUtilDarkMode.ps1
Remove-WinUtilAPPX.ps1
Test-WinUtilPackageManager.ps1
Update-WinUtilProgramWinget.ps1
Invoke-WPFUpdatessecurity.ps1
* Tweak a few more comments
* Tweak another write-host statement
* Undo Catch statement adjustment
It's outside of the scope of this pull request
* Trim Trailing Whitespace (#1085)
* Trim Trailing Whitespace
* Revert "Trim Trailing Whitespace"
This reverts commit 0ce32aa2c2
.
* Trim Trailing Whitespace, take 2
* Bug Fixes
- Edge Removal pullback to local
- Formatting fixes
* testing refactor to ps1
* Update winget-install to 3.0.1 (#1086)
* Update tweaks.json (#1087)
Capitalized first letter of "path" --> "Path" keys
* Update edgeremoval.ps1
* Update edgeremoval.ps1
* Update edgeremoval.ps1
add error handling
* Update functions.Tests.ps1
* fix catch error
* add MSI Afterburner (#1097)
* Add GitHub stats
* Remove Application Experience
* Thorium addition
* remove sample submission
* testing
* Ultimate Performance
* Home GPEDIT
* Fix Winget Install on New System
---------
Co-authored-by: DeveloperDurp <developerdurp@durp.info>
Co-authored-by: Justawildwolf <62820836+blusewill@users.noreply.github.com>
Co-authored-by: Tim Stone <github@tsdev.au>
Co-authored-by: Will Barnard <5012445+mrwillbarnz@users.noreply.github.com>
Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
Co-authored-by: Carter <60557606+Carterpersall@users.noreply.github.com>
Co-authored-by: Yorai Levi <yorai.email@gmail.com>
Co-authored-by: Saikrishnan K <53394202+K-Saikrishnan@users.noreply.github.com>
This commit is contained in:
parent
051b770661
commit
d0bde83333
@ -99,3 +99,6 @@ Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep roc
|
||||
|
||||
[![Contributors](https://contrib.rocks/image?repo=ChrisTitusTech/winutil)](https://github.com/ChrisTitusTech/winutil/graphs/contributors)
|
||||
|
||||
## GitHub Stats
|
||||
|
||||
![Alt](https://repobeats.axiom.co/api/embed/aad37eec9114c507f109d34ff8d38a59adc9503f.svg "Repobeats analytics image")
|
@ -19,6 +19,10 @@
|
||||
"winget": "AnyDeskSoftwareGmbH.AnyDesk",
|
||||
"choco": "anydesk"
|
||||
},
|
||||
"WPFInstallaimp": {
|
||||
"winget": "AIMP.AIMP",
|
||||
"choco": "aimp"
|
||||
},
|
||||
"WPFInstallaudacity": {
|
||||
"winget": "Audacity.Audacity",
|
||||
"choco": "audacity"
|
||||
@ -91,6 +95,10 @@
|
||||
"winget": "Microsoft.DotNet.DesktopRuntime.6",
|
||||
"choco": "dotnet-6.0-runtime"
|
||||
},
|
||||
"WPFInstalldotnet7": {
|
||||
"winget": "Microsoft.DotNet.DesktopRuntime.7",
|
||||
"choco": "dotnet-7.0-runtime"
|
||||
},
|
||||
"WPFInstalleaapp": {
|
||||
"winget": "ElectronicArts.EADesktop",
|
||||
"choco": "ea-app"
|
||||
@ -143,6 +151,10 @@
|
||||
"winget": "GIMP.GIMP",
|
||||
"choco": "gimp"
|
||||
},
|
||||
"WPFInstallguilded": {
|
||||
"winget": "Guilded.Guilded",
|
||||
"choco": ""
|
||||
},
|
||||
"WPFInstallgit": {
|
||||
"Winget": "Git.Git",
|
||||
"choco": "git"
|
||||
@ -303,6 +315,10 @@
|
||||
"winget": "mRemoteNG.mRemoteNG",
|
||||
"choco": "mremoteng"
|
||||
},
|
||||
"WPFInstallmsiafterburner": {
|
||||
"winget": "Guru3D.Afterburner",
|
||||
"choco": "msiafterburner"
|
||||
},
|
||||
"WPFInstallmusicbee": {
|
||||
"winget": "MusicBee.MusicBee",
|
||||
"choco": "musicbee"
|
||||
@ -491,6 +507,10 @@
|
||||
"winget": "SumatraPDF.SumatraPDF",
|
||||
"choco": "sumatrapdf"
|
||||
},
|
||||
"WPFInstallsuperf4": {
|
||||
"winget": "StefanSundin.Superf4",
|
||||
"choco": "superf4"
|
||||
},
|
||||
"WPFInstalltcpview": {
|
||||
"winget": "Microsoft.Sysinternals.TCPView",
|
||||
"choco": "tcpview"
|
||||
@ -511,6 +531,10 @@
|
||||
"winget": "Microsoft.WindowsTerminal",
|
||||
"choco": "microsoft-windows-terminal"
|
||||
},
|
||||
"WPFInstallthorium": {
|
||||
"winget": "Alex313031.Thorium",
|
||||
"choco": "na"
|
||||
},
|
||||
"WPFInstalltor": {
|
||||
"Winget": "TorProject.TorBrowser",
|
||||
"choco": "tor-browser"
|
||||
@ -547,6 +571,10 @@
|
||||
"winget": "Microsoft.VCRedist.2015+.x64",
|
||||
"choco": "na"
|
||||
},
|
||||
"WPFInstallventoy": {
|
||||
"winget": "na",
|
||||
"choco": "ventoy"
|
||||
},
|
||||
"WPFInstallviber": {
|
||||
"Winget": "Viber.Viber",
|
||||
"choco": "viber"
|
||||
@ -610,6 +638,10 @@
|
||||
"WPFInstallxdm": {
|
||||
"winget": "subhra74.XtremeDownloadManager",
|
||||
"choco": "xdm"
|
||||
},
|
||||
"WPFInstallzerotierone": {
|
||||
"winget": "ZeroTier.ZeroTierOne",
|
||||
"choco": "zerotier-one"
|
||||
},
|
||||
"WPFInstallzoom": {
|
||||
"winget": "Zoom.Zoom",
|
||||
|
@ -45,7 +45,7 @@ $ChocoCommand = ""
|
||||
$ButtonToAdd = New-Object psobject
|
||||
$jsonfile = Get-Content ./config/applications.json | ConvertFrom-Json
|
||||
|
||||
#remove if already exists
|
||||
# Remove if already exists
|
||||
if($jsonfile.$NameofButton){
|
||||
$jsonfile.psobject.Properties.remove($NameofButton)
|
||||
}
|
||||
@ -97,7 +97,7 @@ $commands = @(
|
||||
|
||||
$jsonfile = Get-Content ./config/feature.json | ConvertFrom-Json
|
||||
|
||||
#remove if already exists
|
||||
# Remove if already exists
|
||||
if($jsonfile.$NameofButton){
|
||||
$jsonfile.psobject.Properties.remove($NameofButton)
|
||||
}
|
||||
@ -159,7 +159,7 @@ $commands = @(
|
||||
|
||||
$jsonfile = Get-Content ./config/preset.json | ConvertFrom-Json
|
||||
|
||||
#remove if already exists
|
||||
# Remove if already exists
|
||||
if($jsonfile.$NameofButton){
|
||||
$jsonfile.psobject.Properties.remove($NameofButton)
|
||||
}
|
||||
@ -290,7 +290,7 @@ Example:
|
||||
# Make sure to uncomment the sections you which to add.
|
||||
|
||||
#$Registry = @(
|
||||
# #to add more repeat this separated by a comma
|
||||
# # To add more repeat this separated by a comma
|
||||
# @{
|
||||
# Path = ""
|
||||
# Name = ""
|
||||
@ -301,7 +301,7 @@ Example:
|
||||
#)
|
||||
|
||||
#$Service = @(
|
||||
# #to add more repeat this separated by a comma
|
||||
# # To add more repeat this separated by a comma
|
||||
# @{
|
||||
# Name = ""
|
||||
# StartupType = ""
|
||||
@ -310,7 +310,7 @@ Example:
|
||||
#)
|
||||
|
||||
#$ScheduledTask = @(
|
||||
# #to add more repeat this separated by a comma
|
||||
# # To add more repeat this separated by a comma
|
||||
# @{
|
||||
# Name = ""
|
||||
# State = ""
|
||||
@ -335,7 +335,7 @@ $NameofButton = "WPF" + ""
|
||||
$ButtonToAdd = New-Object psobject
|
||||
$jsonfile = Get-Content ./config/tweaks.json | ConvertFrom-Json
|
||||
|
||||
#remove if already exists
|
||||
# Remove if already exists
|
||||
if($jsonfile.$NameofButton){
|
||||
$jsonfile.psobject.Properties.remove($NameofButton)
|
||||
}
|
||||
@ -389,7 +389,7 @@ $IPAddress = @{
|
||||
$ButtonToAdd = New-Object psobject
|
||||
$jsonfile = Get-Content ./config/dns.json | ConvertFrom-Json
|
||||
|
||||
#remove if already exists
|
||||
# Remove if already exists
|
||||
if($jsonfile.$NameofProvider){
|
||||
$jsonfile.psobject.Properties.remove($NameofProvider)
|
||||
}
|
||||
|
@ -1556,6 +1556,26 @@
|
||||
"Name": "Microsoft\\Windows\\Windows Error Reporting\\QueueReporting",
|
||||
"State": "Disabled",
|
||||
"OriginalState": "Enabled"
|
||||
},
|
||||
{
|
||||
"Name": "Microsoft\\Windows\\Application Experience\\MareBackup",
|
||||
"State": "Disabled",
|
||||
"OriginalState": "Enabled"
|
||||
},
|
||||
{
|
||||
"Name": "Microsoft\\Windows\\Application Experience\\StartupAppTask",
|
||||
"State": "Disabled",
|
||||
"OriginalState": "Enabled"
|
||||
},
|
||||
{
|
||||
"Name": "Microsoft\\Windows\\Application Experience\\PcaPatchDbTask",
|
||||
"State": "Disabled",
|
||||
"OriginalState": "Enabled"
|
||||
},
|
||||
{
|
||||
"Name": "Microsoft\\Windows\\Maps\\MapsUpdateTask",
|
||||
"State": "Disabled",
|
||||
"OriginalState": "Enabled"
|
||||
}
|
||||
],
|
||||
"registry": [
|
||||
@ -1842,7 +1862,8 @@
|
||||
}
|
||||
],
|
||||
"InvokeScript": [
|
||||
"bcdedit /set `{current`} bootmenupolicy Legacy | Out-Null
|
||||
"
|
||||
bcdedit /set `{current`} bootmenupolicy Legacy | Out-Null
|
||||
If ((get-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\" -Name CurrentBuild).CurrentBuild -lt 22557) {
|
||||
$taskmgr = Start-Process -WindowStyle Hidden -FilePath taskmgr.exe -PassThru
|
||||
Do {
|
||||
@ -1864,6 +1885,9 @@
|
||||
Remove-Item \"$autoLoggerDir\\AutoLogger-Diagtrack-Listener.etl\"
|
||||
}
|
||||
icacls $autoLoggerDir /deny SYSTEM:`(OI`)`(CI`)F | Out-Null
|
||||
|
||||
# Disable Defender Auto Sample Submission
|
||||
Set-MpPreference -SubmitSamplesConsent 2 -ErrorAction SilentlyContinue | Out-Null
|
||||
"
|
||||
]
|
||||
},
|
||||
@ -1910,84 +1934,84 @@
|
||||
"WPFMiscTweaksDisplay": {
|
||||
"registry": [
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Desktop",
|
||||
"Path": "HKCU:\\Control Panel\\Desktop",
|
||||
"OriginalValue": "1",
|
||||
"Name": "DragFullWindows",
|
||||
"Value": "0",
|
||||
"Type": "String"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Desktop",
|
||||
"Path": "HKCU:\\Control Panel\\Desktop",
|
||||
"OriginalValue": "1",
|
||||
"Name": "MenuShowDelay",
|
||||
"Value": "200",
|
||||
"Type": "String"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Desktop\\WindowMetrics",
|
||||
"Path": "HKCU:\\Control Panel\\Desktop\\WindowMetrics",
|
||||
"OriginalValue": "1",
|
||||
"Name": "MinAnimate",
|
||||
"Value": "0",
|
||||
"Type": "String"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Keyboard",
|
||||
"Path": "HKCU:\\Control Panel\\Keyboard",
|
||||
"OriginalValue": "1",
|
||||
"Name": "KeyboardDelay",
|
||||
"Value": "0",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"OriginalValue": "1",
|
||||
"Name": "ListviewAlphaSelect",
|
||||
"Value": "0",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"OriginalValue": "1",
|
||||
"Name": "ListviewShadow",
|
||||
"Value": "0",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"OriginalValue": "1",
|
||||
"Name": "TaskbarAnimations",
|
||||
"Value": "0",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VisualEffects",
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VisualEffects",
|
||||
"OriginalValue": "1",
|
||||
"Name": "VisualFXSetting",
|
||||
"Value": "3",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Software\\Microsoft\\Windows\\DWM",
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\DWM",
|
||||
"OriginalValue": "1",
|
||||
"Name": "EnableAeroPeek",
|
||||
"Value": "0",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"OriginalValue": "1",
|
||||
"Name": "TaskbarMn",
|
||||
"Value": "0",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"OriginalValue": "1",
|
||||
"Name": "TaskbarDa",
|
||||
"Value": "0",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
"OriginalValue": "1",
|
||||
"Name": "ShowTaskViewButton",
|
||||
"Value": "0",
|
||||
@ -2142,7 +2166,7 @@
|
||||
"WPFMiscTweaksLapNum": {
|
||||
"Registry": [
|
||||
{
|
||||
"path": "HKU:\\.DEFAULT\\Control Panel\\Keyboard",
|
||||
"Path": "HKU:\\.DEFAULT\\Control Panel\\Keyboard",
|
||||
"OriginalValue": "1",
|
||||
"Name": "InitialKeyboardIndicators",
|
||||
"Value": "0",
|
||||
@ -2153,7 +2177,7 @@
|
||||
"WPFMiscTweaksNum": {
|
||||
"Registry": [
|
||||
{
|
||||
"path": "HKU:\\.DEFAULT\\Control Panel\\Keyboard",
|
||||
"Path": "HKU:\\.DEFAULT\\Control Panel\\Keyboard",
|
||||
"OriginalValue": "1",
|
||||
"Name": "InitialKeyboardIndicators",
|
||||
"Value": "80000002",
|
||||
@ -2166,7 +2190,7 @@
|
||||
"
|
||||
#:: 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
|
||||
curl.exe -s \"https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/edgeremoval.bat\" -o $ENV:temp\\edgeremoval.bat
|
||||
Start-Process $ENV:temp\\edgeremoval.bat
|
||||
|
||||
"
|
||||
@ -2295,7 +2319,7 @@
|
||||
"WPFMiscTweaksDisableUAC": {
|
||||
"registry": [
|
||||
{
|
||||
"path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",
|
||||
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",
|
||||
"OriginalValue": "5",
|
||||
"Name": "ConsentPromptBehaviorAdmin",
|
||||
"Value": "0",
|
||||
@ -2306,21 +2330,21 @@
|
||||
"WPFMiscTweaksDisableMouseAcceleration": {
|
||||
"registry": [
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Mouse",
|
||||
"Path": "HKCU:\\Control Panel\\Mouse",
|
||||
"OriginalValue": "1",
|
||||
"Name": "MouseSpeed",
|
||||
"Value": "0",
|
||||
"Type": "String"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Mouse",
|
||||
"Path": "HKCU:\\Control Panel\\Mouse",
|
||||
"OriginalValue": "6",
|
||||
"Name": "MouseThreshold1",
|
||||
"Value": "0",
|
||||
"Type": "String"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Mouse",
|
||||
"Path": "HKCU:\\Control Panel\\Mouse",
|
||||
"OriginalValue": "10",
|
||||
"Name": "MouseThreshold2",
|
||||
"Value": "0",
|
||||
@ -2331,21 +2355,21 @@
|
||||
"WPFMiscTweaksEnableMouseAcceleration": {
|
||||
"registry": [
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Mouse",
|
||||
"Path": "HKCU:\\Control Panel\\Mouse",
|
||||
"OriginalValue": "1",
|
||||
"Name": "MouseSpeed",
|
||||
"Value": "1",
|
||||
"Type": "String"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Mouse",
|
||||
"Path": "HKCU:\\Control Panel\\Mouse",
|
||||
"OriginalValue": "6",
|
||||
"Name": "MouseThreshold1",
|
||||
"Value": "6",
|
||||
"Type": "String"
|
||||
},
|
||||
{
|
||||
"path": "HKCU:\\Control Panel\\Mouse",
|
||||
"Path": "HKCU:\\Control Panel\\Mouse",
|
||||
"OriginalValue": "10",
|
||||
"Name": "MouseThreshold2",
|
||||
"Value": "10",
|
||||
@ -2356,7 +2380,7 @@
|
||||
"WPFMiscTweaksEnableVerboselogon": {
|
||||
"registry": [
|
||||
{
|
||||
"path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\system",
|
||||
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\system",
|
||||
"OriginalValue": "0",
|
||||
"Name": "VerboseStatus",
|
||||
"Value": "1",
|
||||
|
236
edgeremoval.bat
Normal file
236
edgeremoval.bat
Normal file
@ -0,0 +1,236 @@
|
||||
@(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit /b
|
||||
#:: made by AveYo source: https://raw.githubusercontent.com/AveYo/fox/main/Edge_Removal.bat
|
||||
sp 'HKCU:\Volatile Environment' 'Edge_Removal' @'
|
||||
|
||||
$also_remove_webview = 0
|
||||
|
||||
$host.ui.RawUI.WindowTitle = 'Edge Removal - AveYo, 2023.09.09'
|
||||
$remove_win32 = @("Microsoft Edge","Microsoft Edge Update"); $remove_appx = @("MicrosoftEdge"); $skip = @() # @("DevTools")
|
||||
if ($also_remove_webview -eq 1) {$remove_win32 += "Microsoft EdgeWebView"; $remove_appx += "WebExperience","Win32WebViewHost"}
|
||||
|
||||
## 1 bonus! enter into powershell console: firefox / edge / webview to install a browser / reinstall edge or webview after removal
|
||||
function global:firefox { $url = 'https://download.mozilla.org/?product=firefox-stub'
|
||||
$setup = "$((new-object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path)\Firefox Installer.exe"
|
||||
write-host $url; Invoke-WebRequest $url -OutFile $setup; start $setup
|
||||
}
|
||||
function global:edge { $url = 'https://go.microsoft.com/fwlink/?linkid=2108834&Channel=Stable&language=en'
|
||||
$setup = "$((new-object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path)\MicrosoftEdgeSetup.exe"
|
||||
write-host $url; Invoke-WebRequest $url -OutFile $setup; prepare_edge; start $setup
|
||||
}
|
||||
function global:webview { $url = 'https://go.microsoft.com/fwlink/p/?LinkId=2124703'
|
||||
$setup = "$((new-object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path)\MicrosoftEdgeWebview2Setup.exe"
|
||||
write-host $url; Invoke-WebRequest $url -OutFile $setup; prepare_webview; start $setup
|
||||
}
|
||||
## helper for set-itemproperty remove-itemproperty new-item remove-item with auto test-path
|
||||
function global:sp_test_path { if (test-path $args[0]) {Microsoft.PowerShell.Management\Set-ItemProperty @args} else {
|
||||
Microsoft.PowerShell.Management\New-Item $args[0] -force -ea 0 >''; Microsoft.PowerShell.Management\Set-ItemProperty @args} }
|
||||
function global:rp_test_path { if (test-path $args[0]) {Microsoft.PowerShell.Management\Remove-ItemProperty @args} }
|
||||
function global:ni_test_path { if (-not (test-path $args[0])) {Microsoft.PowerShell.Management\New-Item @args} }
|
||||
function global:ri_test_path { if (test-path $args[0]) {Microsoft.PowerShell.Management\Remove-Item @args} }
|
||||
foreach ($f in 'sp','rp','ni','ri') {set-alias -Name $f -Value "${f}_test_path" -Scope Local -Option AllScope -force -ea 0}
|
||||
## helper for edge reinstall - remove bundled OpenWebSearch redirector and edgeupdate policies
|
||||
function global:prepare_edge {
|
||||
foreach ($f in 'ni','ri','sp','rp') {set-alias -Name $f -Value "${f}_test_path" -Scope Local -Option AllScope -force -ea 0}
|
||||
$MS=($env:ProgramFiles,${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem]+'\Microsoft\Edge\Application\msedge.exe'
|
||||
ri "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe" -recurse -force -ea 0
|
||||
ri "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ie_to_edge_stub.exe" -recurse -force -ea 0
|
||||
ri 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\microsoft-edge' -recurse -force -ea 0
|
||||
ri 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\MSEdgeHTM' -recurse -force -ea 0
|
||||
ni "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -force -ea 0 >''
|
||||
sp "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" '(Default)' "`"$MS`" --single-argument %%1" -force -ea 0
|
||||
ni "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -force -ea 0 >''
|
||||
sp "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" '(Default)' "`"$MS`" --single-argument %%1" -force -ea 0
|
||||
foreach ($p in 'HKLM:\SOFTWARE\Policies','HKLM:\SOFTWARE','HKLM:\SOFTWARE\WOW6432Node') {
|
||||
rp "$p\Microsoft\EdgeUpdate" 'InstallDefault' -force -ea 0
|
||||
rp "$p\Microsoft\EdgeUpdate" 'Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' -force -ea 0
|
||||
rp "$p\Microsoft\EdgeUpdate" 'Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' -force -ea 0
|
||||
}
|
||||
$edgeupdate='Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}'
|
||||
$webvupdate='Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
|
||||
$on_actions='on-os-upgrade','on-logon','on-logon-autolaunch','on-logon-startup-boost'
|
||||
foreach ($p in 'HKLM:\SOFTWARE','HKLM:\SOFTWARE\Wow6432Node') { foreach ($launch in $on_actions) {
|
||||
ri "$p\$edgeupdate\Commands\$launch" -force -ea 0; ri "$p\$webvupdate\Commands\$launch" -force -ea 0
|
||||
}}
|
||||
}
|
||||
## helper for webview reinstall - restore webexperience (widgets) if available
|
||||
function global:prepare_webview {
|
||||
$cfg = @{Register=$true; ForceApplicationShutdown=$true; ForceUpdateFromAnyVersion=$true; DisableDevelopmentMode=$true}
|
||||
dir "$env:ProgramFiles\WindowsApps\MicrosoftWindows.Client.WebExperience*\AppxManifest.xml" -rec -ea 0 | Add-AppxPackage @cfg
|
||||
dir "$env:SystemRoot\SystemApps\Microsoft.Win32WebViewHost*\AppxManifest.xml" -rec -ea 0 | Add-AppxPackage @cfg
|
||||
kill -name explorer -ea 0; if ((get-process -name 'explorer' -ea 0) -eq $null) {start explorer}
|
||||
}
|
||||
|
||||
## 2 enable admin privileges
|
||||
$D1=[uri].module.gettype('System.Diagnostics.Process')."GetM`ethods"(42) |where {$_.Name -eq 'SetPrivilege'} #`:no-ev-warn
|
||||
'SeSecurityPrivilege','SeTakeOwnershipPrivilege','SeBackupPrivilege','SeRestorePrivilege'|foreach {$D1.Invoke($null, @("$_",2))}
|
||||
|
||||
## 3 shut edge & webview clone stuff down and gather install paths
|
||||
$shut = 'explorer','Widgets','widgetservice','msedgewebview2','MicrosoftEdge*','chredge','msedge','edge'
|
||||
$shut+= 'msteams','msfamily','WebViewHost','Clipchamp'
|
||||
cd $env:systemdrive; taskkill /im explorer.exe /f 2>&1 >''; foreach ($p in $shut) {kill -name $p -force -ea 0}
|
||||
prepare_edge
|
||||
## clear win32 uninstall block
|
||||
foreach ($hk in 'HKCU:','HKLM:') { foreach ($wow in '','\Wow6432Node') { foreach ($i in $remove_win32) {
|
||||
rp "$hk\SOFTWARE${wow}\Microsoft\Windows\CurrentVersion\Uninstall\$i" 'NoRemove' -force -ea 0
|
||||
ni "$hk\SOFTWARE${wow}\Microsoft\EdgeUpdateDev" -force >''
|
||||
sp "$hk\SOFTWARE${wow}\Microsoft\EdgeUpdateDev" 'AllowUninstall' 1 -type Dword -force
|
||||
}}}
|
||||
## find all Edge setup.exe and gather BHO paths for OpenWebSearch / MSEdgeRedirect usage
|
||||
$edges = @(); $bho = @(); 'LocalApplicationData','ProgramFilesX86','ProgramFiles' |foreach {
|
||||
$folder = [Environment]::GetFolderPath($_); $bho += dir "$folder\Microsoft\Edge*\ie_to_edge_stub.exe" -rec -ea 0
|
||||
if ($also_remove_webview -eq 1) {$edges += dir "$folder\Microsoft\Edge*\setup.exe" -rec -ea 0 |where {$_ -like '*EdgeWebView*'}}
|
||||
$edges += dir "$folder\Microsoft\Edge*\setup.exe" -rec -ea 0 |where {$_ -notlike '*EdgeWebView*'}
|
||||
}
|
||||
## use dedicated C:\Scripts path to save OpenWebSearch (due to Sigma rules FUD)
|
||||
$DIR = "$env:SystemDrive\Scripts"; mkdir $DIR -ea 0 >''
|
||||
## export OpenWebSearch innovative redirector - used by MSEdgeRedirect as well
|
||||
foreach ($b in $bho) { if (test-path $b) { try {copy $b "$DIR\ie_to_edge_stub.exe" -force -ea 0} catch{} } }
|
||||
|
||||
## 4 remove found *Edge* appx packages with unblock tricks
|
||||
$provisioned = get-appxprovisionedpackage -online; $appxpackage = get-appxpackage -allusers; $eol = @()
|
||||
$store = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore'
|
||||
$users = @('S-1-5-18'); if (test-path $store) {$users += $((dir $store -ea 0 |where {$_ -like '*S-1-5-21*'}).PSChildName)}
|
||||
foreach ($choice in $remove_appx) { if ('' -eq $choice.Trim()) {continue}
|
||||
foreach ($appx in $($provisioned |where {$_.PackageName -like "*$choice*"})) {
|
||||
$next = !1; foreach ($no in $skip) {if ($appx.PackageName -like "*$no*") {$next = !0}} ; if ($next) {continue}
|
||||
$PackageName = $appx.PackageName; $PackageFamilyName = ($appxpackage |where {$_.Name -eq $appx.DisplayName}).PackageFamilyName
|
||||
ni "$store\Deprovisioned\$PackageFamilyName" -force >''; $PackageFamilyName
|
||||
foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageName" -force >''} ; $eol += $PackageName
|
||||
dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >''
|
||||
remove-appxprovisionedpackage -packagename $PackageName -online -allusers >''
|
||||
}
|
||||
foreach ($appx in $($appxpackage |where {$_.PackageFullName -like "*$choice*"})) {
|
||||
$next = !1; foreach ($no in $skip) {if ($appx.PackageFullName -like "*$no*") {$next = !0}} ; if ($next) {continue}
|
||||
$PackageFullName = $appx.PackageFullName;
|
||||
ni "$store\Deprovisioned\$appx.PackageFamilyName" -force >''; $PackageFullName
|
||||
foreach ($sid in $users) {ni "$store\EndOfLife\$sid\$PackageFullName" -force >''} ; $eol += $PackageFullName
|
||||
dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 >''
|
||||
remove-appxpackage -package $PackageFullName -allusers >''
|
||||
}
|
||||
}
|
||||
|
||||
## 5 run found *Edge* setup.exe with uninstall args and wait in-between
|
||||
foreach ($setup in $edges) { if (test-path $setup) {
|
||||
if ($setup -like '*EdgeWebView*') {$target = "--msedgewebview"} else {$target = "--msedge"}
|
||||
$removal = "--uninstall $target --system-level --verbose-logging --force-uninstall"
|
||||
try {write-host $setup $removal; start -wait $setup -args $removal} catch {}
|
||||
do {sleep 3} while ((get-process -name 'setup','MicrosoftEdge*' -ea 0).Path -like '*\Microsoft\Edge*')
|
||||
}}
|
||||
|
||||
## 6 extra cleanup
|
||||
foreach ($PF in $env:ProgramFiles,${env:ProgramFiles(x86)}) { if (test-path "$PF\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe") {
|
||||
write-host "$PF\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe /uninstall"
|
||||
start -wait "$PF\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe" -args '/uninstall'
|
||||
do {sleep 3} while ((get-process -name 'setup','MicrosoftEdge*' -ea 0).Path -like '*\Microsoft\Edge*')
|
||||
if ($also_remove_webview -eq 1) { foreach ($hk in 'HKCU:','HKLM:') { foreach ($wow in '','\Wow6432Node') {
|
||||
ri "$hk\SOFTWARE${wow}\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" -rec -force -ea 0 }}
|
||||
ri "$PF\Microsoft\EdgeUpdate" -rec -force -ea 0; Unregister-ScheduledTask -TaskName MicrosoftEdgeUpdate* -Confirm:$false -ea 0
|
||||
}
|
||||
}}
|
||||
$appdata = $([Environment]::GetFolderPath('ApplicationData'))
|
||||
ri "$appdata\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Tombstones\Microsoft Edge.lnk" -force
|
||||
ri "$appdata\Microsoft\Internet Explorer\Quick Launch\Microsoft Edge.lnk" -force
|
||||
|
||||
## undo eol unblock trick to prevent latest cumulative update (LCU) failing
|
||||
foreach ($sid in $users) { foreach ($PackageName in $eol) {ri "$store\EndOfLife\$sid\$PackageName" -force >''} }
|
||||
|
||||
## set (almost) useless policies to prevent unsolicited reinstalls
|
||||
foreach ($p in 'HKLM:\SOFTWARE\Policies','HKLM:\SOFTWARE','HKLM:\SOFTWARE\WOW6432Node') {
|
||||
ni "$p\Microsoft\EdgeUpdate" -force >''
|
||||
sp "$p\Microsoft\EdgeUpdate" 'InstallDefault' 0 -type Dword -force
|
||||
sp "$p\Microsoft\EdgeUpdate" 'Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' 0 -type Dword -force
|
||||
sp "$p\Microsoft\EdgeUpdate" 'Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' 1 -type Dword -force
|
||||
sp "$p\Microsoft\EdgeUpdate" 'DoNotUpdateToEdgeWithChromium' 1 -type Dword -force
|
||||
}
|
||||
$edgeupdate='Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}'
|
||||
$webvupdate='Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
|
||||
$on_actions='on-os-upgrade','on-logon','on-logon-autolaunch','on-logon-startup-boost'
|
||||
foreach ($p in 'HKLM:\SOFTWARE','HKLM:\SOFTWARE\Wow6432Node') { foreach ($launch in $on_actions) {
|
||||
ni "$p\$edgeupdate\Commands\$launch" -force >''; sp "$p\$edgeupdate\Commands\$launch" 'CommandLine' 'systray.exe' -force
|
||||
ni "$p\$webvupdate\Commands\$launch" -force >''; sp "$p\$webvupdate\Commands\$launch" 'CommandLine' 'systray.exe' -force
|
||||
}}
|
||||
|
||||
## 7 add bundled OpenWebSearch script to redirect microsoft-edge: anti-competitive links to the default browser
|
||||
$MSEP = ($env:ProgramFiles,${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem] + '\Microsoft\Edge\Application'
|
||||
$IFEO = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options'
|
||||
$MIN = ('--headless','--width 1 --height 1')[([environment]::OSVersion.Version.Build) -gt 25179]
|
||||
$CMD = "$env:systemroot\system32\conhost.exe $MIN" # AveYo: minimize prompt - see Terminal issue #13914
|
||||
ni "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -force >''
|
||||
sp "HKLM:\SOFTWARE\Classes\microsoft-edge" '(Default)' 'URL:microsoft-edge' -force
|
||||
sp "HKLM:\SOFTWARE\Classes\microsoft-edge" 'URL Protocol' '' -force
|
||||
sp "HKLM:\SOFTWARE\Classes\microsoft-edge" 'NoOpenWith' '' -force
|
||||
sp "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" '(Default)' "`"$DIR\ie_to_edge_stub.exe`" %1" -force
|
||||
ni "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -force >''
|
||||
sp "HKLM:\SOFTWARE\Classes\MSEdgeHTM" 'NoOpenWith' '' -force
|
||||
sp "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" '(Default)' "`"$DIR\ie_to_edge_stub.exe`" %1" -force
|
||||
ni "$IFEO\ie_to_edge_stub.exe\0" -force >''
|
||||
sp "$IFEO\ie_to_edge_stub.exe" 'UseFilter' 1 -type Dword -force
|
||||
sp "$IFEO\ie_to_edge_stub.exe\0" 'FilterFullPath' "$DIR\ie_to_edge_stub.exe" -force
|
||||
sp "$IFEO\ie_to_edge_stub.exe\0" 'Debugger' "$CMD $DIR\OpenWebSearch.cmd" -force
|
||||
ni "$IFEO\msedge.exe\0" -force >''
|
||||
sp "$IFEO\msedge.exe" 'UseFilter' 1 -type Dword -force
|
||||
sp "$IFEO\msedge.exe\0" 'FilterFullPath' "$MSEP\msedge.exe" -force
|
||||
sp "$IFEO\msedge.exe\0" 'Debugger' "$CMD $DIR\OpenWebSearch.cmd" -force
|
||||
|
||||
$OpenWebSearch = @$
|
||||
@title OpenWebSearch Redux & echo off & set ?= open start menu web search, widgets links or help in your chosen browser - by AveYo
|
||||
for /f %%E in ('"prompt $E$S& for %%e in (1) do rem"') do echo;%%E[2t 2>nul & rem AveYo: minimize prompt
|
||||
call :reg_var "HKCU\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" ProgID ProgID
|
||||
if /i "%ProgID%" equ "MSEdgeHTM" echo;Default browser is set to Edge! Change it or remove OpenWebSearch script. & pause & exit /b
|
||||
call :reg_var "HKCR\%ProgID%\shell\open\command" "" Browser
|
||||
set Choice=& for %%. in (%Browser%) do if not defined Choice set "Choice=%%~."
|
||||
call :reg_var "HKCR\MSEdgeMHT\shell\open\command" "" FallBack
|
||||
set "Edge=" & for %%. in (%FallBack%) do if not defined Edge set "Edge=%%~."
|
||||
set "URI=" & set "URL=" & set "NOOP=" & set "PassTrough=%Edge:msedge=edge%"
|
||||
set "CLI=%CMDCMDLINE:"=``% "
|
||||
if defined CLI set "CLI=%CLI:*ie_to_edge_stub.exe`` =%"
|
||||
if defined CLI set "CLI=%CLI:*ie_to_edge_stub.exe =%"
|
||||
if defined CLI set "CLI=%CLI:*msedge.exe`` =%"
|
||||
if defined CLI set "CLI=%CLI:*msedge.exe =%"
|
||||
set "FIX=%CLI:~-1%"
|
||||
if defined CLI if "%FIX%"==" " set "CLI=%CLI:~0,-1%"
|
||||
if defined CLI set "RED=%CLI:microsoft-edge=%"
|
||||
if defined CLI set "URL=%CLI:http=%"
|
||||
if defined CLI set "ARG=%CLI:``="%"
|
||||
if "%CLI%" equ "%RED%" (set NOOP=1) else if "%CLI%" equ "%URL%" (set NOOP=1)
|
||||
if defined NOOP if exist "%PassTrough%" start "" "%PassTrough%" %ARG%
|
||||
if defined NOOP exit /b
|
||||
set "URL=%CLI:*microsoft-edge=%"
|
||||
set "URL=http%URL:*http=%"
|
||||
set "FIX=%URL:~-2%"
|
||||
if defined URL if "%FIX%"=="``" set "URL=%URL:~0,-2%"
|
||||
call :dec_url
|
||||
start "" "%Choice%" "%URL%"
|
||||
exit
|
||||
|
||||
:reg_var [USAGE] call :reg_var "HKCU\Volatile Environment" value-or-"" variable [extra options]
|
||||
set {var}=& set {reg}=reg query "%~1" /v %2 /z /se "," /f /e& if %2=="" set {reg}=reg query "%~1" /ve /z /se "," /f /e
|
||||
for /f "skip=2 tokens=* delims=" %%V in ('%{reg}% %4 %5 %6 %7 %8 %9 2^>nul') do if not defined {var} set "{var}=%%V"
|
||||
if not defined {var} (set {reg}=& set "%~3="& exit /b) else if %2=="" set "{var}=%{var}:*) =%"& rem AveYo: v3
|
||||
if not defined {var} (set {reg}=& set "%~3="& exit /b) else set {reg}=& set "%~3=%{var}:*) =%"& set {var}=& exit /b
|
||||
|
||||
:dec_url brute url percent decoding by AveYo
|
||||
set ".=%URL:!=}%"&setlocal enabledelayedexpansion& rem brute url percent decoding
|
||||
set ".=!.:%%={!" &set ".=!.:{3A=:!" &set ".=!.:{2F=/!" &set ".=!.:{3F=?!" &set ".=!.:{23=#!" &set ".=!.:{5B=[!" &set ".=!.:{5D=]!"
|
||||
set ".=!.:{40=@!"&set ".=!.:{21=}!" &set ".=!.:{24=$!" &set ".=!.:{26=&!" &set ".=!.:{27='!" &set ".=!.:{28=(!" &set ".=!.:{29=)!"
|
||||
set ".=!.:{2A=*!"&set ".=!.:{2B=+!" &set ".=!.:{2C=,!" &set ".=!.:{3B=;!" &set ".=!.:{3D==!" &set ".=!.:{25=%%!"&set ".=!.:{20= !"
|
||||
set ".=!.:{=%%!" &rem set ",=!.:%%=!" & if "!,!" neq "!.!" endlocal& set "URL=%.:}=!%" & call :dec_url
|
||||
endlocal& set "URL=%.:}=!%" & exit /b
|
||||
rem done
|
||||
|
||||
$@
|
||||
[io.file]::WriteAllText("$DIR\OpenWebSearch.cmd", $OpenWebSearch)
|
||||
|
||||
## 8 done
|
||||
$done = gp 'Registry::HKEY_Users\S-1-5-21*\Volatile*' Edge_Removal -ea 0; if ($done) {rp $done.PSPath Edge_Removal -force -ea 0}
|
||||
if ((get-process -name 'explorer' -ea 0) -eq $null) {start explorer}
|
||||
|
||||
## 9 bonus enter into powershell console: firefox / edge / webview to install a browser / reinstall edge or webview after removal
|
||||
${.} = [char]27; $firefox = "${.}[38;2;255;165;0m firefox"; $edge = "${.}[94m edge${.}[97m"; $webview = "${.}[94mwebview ${.}[97m"
|
||||
write-host "`n${.}[40;32m EDGE REMOVED! ${.}[97m -GET-ANOTHER-BROWSER? ENTER:$firefox ${.}[97m -REINSTALL? ENTER:$edge / $webview"
|
||||
|
||||
## 0 ask to run script as admin
|
||||
'@.replace("$@","'@").replace("@$","@'") -force -ea 0; $code='gp ''Registry::HKEY_Users\S-1-5-21*\Volatile*'' Edge_Removal -ea 0'
|
||||
start powershell -args "-nop -noe -c & {iex(($code)[0].Edge_Removal)}" -verb runas
|
||||
$_Press_Enter
|
||||
#::
|
466
edgeremoval.ps1
Normal file
466
edgeremoval.ps1
Normal file
@ -0,0 +1,466 @@
|
||||
# Script Metadata
|
||||
# Created by AveYo, source: https://raw.githubusercontent.com/AveYo/fox/main/Edge_Removal.bat
|
||||
# Powershell Conversion and Refactor done by Chris Titus Tech
|
||||
|
||||
# Initial Configuration
|
||||
$host.ui.RawUI.WindowTitle = 'Edge Removal - Chris Titus Tech 2023.05.10'
|
||||
$remove_win32 = @("Microsoft Edge", "Microsoft Edge Update")
|
||||
$remove_appx = @("MicrosoftEdge")
|
||||
$skip = @() # Optional: @("DevTools")
|
||||
|
||||
$also_remove_webview = 0
|
||||
if ($also_remove_webview -eq 1) {
|
||||
$remove_win32 += "Microsoft EdgeWebView"
|
||||
$remove_appx += "WebExperience", "Win32WebViewHost"
|
||||
}
|
||||
|
||||
# Administrative Privileges Check
|
||||
|
||||
# Get the 'SetPrivilege' method from System.Diagnostics.Process type
|
||||
$setPrivilegeMethod = [System.Diagnostics.Process].GetMethod('SetPrivilege', [System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Static)
|
||||
|
||||
# List of privileges to set
|
||||
$privileges = @(
|
||||
'SeSecurityPrivilege',
|
||||
'SeTakeOwnershipPrivilege',
|
||||
'SeBackupPrivilege',
|
||||
'SeRestorePrivilege'
|
||||
)
|
||||
|
||||
# Invoke the method for each privilege
|
||||
foreach ($privilege in $privileges) {
|
||||
$setPrivilegeMethod.Invoke($null, @($privilege, 2))
|
||||
}
|
||||
|
||||
# Edge Removal Procedures
|
||||
|
||||
# Define processes to shut down
|
||||
$processesToShutdown = @(
|
||||
'explorer', 'Widgets', 'widgetservice', 'msedgewebview2', 'MicrosoftEdge*', 'chredge',
|
||||
'msedge', 'edge', 'msteams', 'msfamily', 'WebViewHost', 'Clipchamp'
|
||||
)
|
||||
|
||||
# Kill explorer process
|
||||
Stop-Process -Name "explorer" -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Kill the processes from the list
|
||||
$processesToShutdown | ForEach-Object {
|
||||
Stop-Process -Name $_ -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Set path for Edge executable
|
||||
$MS = ($env:ProgramFiles, ${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem] + '\Microsoft\Edge\Application\msedge.exe'
|
||||
|
||||
# Clean up certain registry entries
|
||||
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe" -Recurse -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ie_to_edge_stub.exe" -Recurse -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\microsoft-edge' -Recurse -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\MSEdgeHTM' -Recurse -ErrorAction SilentlyContinue
|
||||
|
||||
# Create new registry entries
|
||||
New-Item -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Force -ErrorAction SilentlyContinue
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Name '(Default)' -Value "`"$MS`" --single-argument %%1" -Force -ErrorAction SilentlyContinue
|
||||
|
||||
New-Item -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Force -ErrorAction SilentlyContinue
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Name '(Default)' -Value "`"$MS`" --single-argument %%1" -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Remove certain registry properties
|
||||
$registryPaths = @('HKLM:\SOFTWARE\Policies', 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\WOW6432Node')
|
||||
$edgeProperties = @('InstallDefault', 'Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}', 'Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}')
|
||||
foreach ($path in $registryPaths) {
|
||||
foreach ($prop in $edgeProperties) {
|
||||
Remove-ItemProperty -Path "$path\Microsoft\EdgeUpdate" -Name $prop -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
$edgeupdate = 'Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}'
|
||||
$webvupdate = 'Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
|
||||
$on_actions = @('on-os-upgrade', 'on-logon', 'on-logon-autolaunch', 'on-logon-startup-boost')
|
||||
$registryBases = @('HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\Wow6432Node')
|
||||
foreach ($base in $registryBases) {
|
||||
foreach ($launch in $on_actions) {
|
||||
Remove-Item -Path "$base\$edgeupdate\Commands\$launch" -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "$base\$webvupdate\Commands\$launch" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# Clear specific registry keys
|
||||
$registryPaths = @('HKCU:', 'HKLM:')
|
||||
$nodes = @('', '\Wow6432Node')
|
||||
foreach ($regPath in $registryPaths) {
|
||||
foreach ($node in $nodes) {
|
||||
foreach ($i in $remove_win32) {
|
||||
Remove-ItemProperty -Path "$regPath\SOFTWARE${node}\Microsoft\Windows\CurrentVersion\Uninstall\$i" -Name 'NoRemove' -Force -ErrorAction SilentlyContinue
|
||||
New-Item -Path "$regPath\SOFTWARE${node}\Microsoft\EdgeUpdateDev" -Force | Out-Null
|
||||
Set-ItemProperty -Path "$regPath\SOFTWARE${node}\Microsoft\EdgeUpdateDev" -Name 'AllowUninstall' -Value 1 -Type Dword -Force
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Locate setup.exe and ie_to_edge_stub.exe
|
||||
$foldersToSearch = @('LocalApplicationData', 'ProgramFilesX86', 'ProgramFiles') | ForEach-Object {
|
||||
[Environment]::GetFolderPath($_)
|
||||
}
|
||||
|
||||
$edges = @()
|
||||
$bhoFiles = @()
|
||||
|
||||
foreach ($folder in $foldersToSearch) {
|
||||
$bhoFiles += Get-ChildItem -Path "$folder\Microsoft\Edge*\ie_to_edge_stub.exe" -Recurse -ErrorAction SilentlyContinue
|
||||
|
||||
$edges += Get-ChildItem -Path "$folder\Microsoft\Edge*\setup.exe" -Recurse -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.FullName -notlike '*EdgeWebView*' }
|
||||
}
|
||||
|
||||
# Create directory and copy ie_to_edge_stub.exe to it
|
||||
$destinationDir = "$env:SystemDrive\Scripts"
|
||||
New-Item -Path $destinationDir -ItemType Directory -ErrorAction SilentlyContinue | Out-Null
|
||||
|
||||
foreach ($bhoFile in $bhoFiles) {
|
||||
if (Test-Path $bhoFile) {
|
||||
try {
|
||||
Copy-Item -Path $bhoFile -Destination "$destinationDir\ie_to_edge_stub.exe" -Force
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
|
||||
## Work on Appx Removals
|
||||
|
||||
# Retrieve AppX provisioned packages and all AppX packages
|
||||
$provisioned = Get-AppxProvisionedPackage -Online
|
||||
$appxpackage = Get-AppxPackage -AllUsers
|
||||
|
||||
# Initialize empty array for EndOfLife packages
|
||||
$eol = @()
|
||||
|
||||
# Define user SIDs and retrieve them from the registry
|
||||
$store = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore'
|
||||
$users = @('S-1-5-18')
|
||||
if (Test-Path $store) {
|
||||
$users += (Get-ChildItem $store -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -like '*S-1-5-21*' }).PSChildName
|
||||
}
|
||||
|
||||
# Process AppX packages for removal
|
||||
foreach ($choice in $remove_appx) {
|
||||
if ([string]::IsNullOrWhiteSpace($choice)) { continue }
|
||||
|
||||
# Process provisioned packages
|
||||
$provisioned | Where-Object { $_.PackageName -like "*$choice*" } | ForEach-Object {
|
||||
if ($skip -Contains $_.PackageName) { return }
|
||||
|
||||
$PackageName = $_.PackageName
|
||||
$PackageFamilyName = ($appxpackage | Where-Object { $_.Name -eq $_.DisplayName }).PackageFamilyName
|
||||
|
||||
# Add registry entries
|
||||
New-Item -Path "$store\Deprovisioned\$PackageFamilyName" -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
$users | ForEach-Object {
|
||||
New-Item -Path "$store\EndOfLife\$_\$PackageName" -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
}
|
||||
$eol += $PackageName
|
||||
|
||||
# Modify non-removable app policy and remove package
|
||||
dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 | Out-Null
|
||||
Remove-AppxProvisionedPackage -PackageName $PackageName -Online -AllUsers | Out-Null
|
||||
}
|
||||
|
||||
# Process all AppX packages
|
||||
$appxpackage | Where-Object { $_.PackageFullName -like "*$choice*" } | ForEach-Object {
|
||||
if ($skip -Contains $_.PackageFullName) { return }
|
||||
|
||||
$PackageFullName = $_.PackageFullName
|
||||
|
||||
# Add registry entries
|
||||
New-Item -Path "$store\Deprovisioned\$_.PackageFamilyName" -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
$users | ForEach-Object {
|
||||
New-Item -Path "$store\EndOfLife\$_\$PackageFullName" -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
}
|
||||
$eol += $PackageFullName
|
||||
|
||||
# Modify non-removable app policy and remove package
|
||||
dism /online /set-nonremovableapppolicy /packagefamily:$PackageFamilyName /nonremovable:0 | Out-Null
|
||||
Remove-AppxPackage -Package $PackageFullName -AllUsers | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
## Run Edge setup uninstaller
|
||||
|
||||
foreach ($setup in $edges) {
|
||||
if (Test-Path $setup) {
|
||||
$target = if ($setup -like '*EdgeWebView*') { "--msedgewebview" } else { "--msedge" }
|
||||
|
||||
$removalArgs = "--uninstall $target --system-level --verbose-logging --force-uninstall"
|
||||
|
||||
Write-Host "$setup $removalArgs"
|
||||
|
||||
try {
|
||||
Start-Process -FilePath $setup -ArgumentList $removalArgs -Wait
|
||||
} catch {
|
||||
# You may want to add logging or other error handling here.
|
||||
}
|
||||
|
||||
while ((Get-Process -Name 'setup', 'MicrosoftEdge*' -ErrorAction SilentlyContinue).Path -like '*\Microsoft\Edge*') {
|
||||
Start-Sleep -Seconds 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
## Cleanup
|
||||
|
||||
# Define necessary paths and variables
|
||||
$edgePaths = $env:ProgramFiles, ${env:ProgramFiles(x86)}
|
||||
$appDataPath = [Environment]::GetFolderPath('ApplicationData')
|
||||
|
||||
# Uninstall Microsoft Edge Update
|
||||
foreach ($path in $edgePaths) {
|
||||
$edgeUpdateExe = "$path\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe"
|
||||
if (Test-Path $edgeUpdateExe) {
|
||||
Write-Host $edgeUpdateExe /uninstall
|
||||
Start-Process -FilePath $edgeUpdateExe -ArgumentList '/uninstall' -Wait
|
||||
while ((Get-Process -Name 'setup','MicrosoftEdge*' -ErrorAction SilentlyContinue).Path -like '*\Microsoft\Edge*') {
|
||||
Start-Sleep -Seconds 3
|
||||
}
|
||||
if ($also_remove_webview -eq 1) {
|
||||
foreach ($regPath in 'HKCU:', 'HKLM:') {
|
||||
foreach ($node in '', '\Wow6432Node') {
|
||||
Remove-Item -Path "$regPath\SOFTWARE$node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Remove-Item -Path "$path\Microsoft\EdgeUpdate" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Unregister-ScheduledTask -TaskName 'MicrosoftEdgeUpdate*' -Confirm:$false -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Remove Edge shortcuts
|
||||
Remove-Item -Path "$appDataPath\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Tombstones\Microsoft Edge.lnk" -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "$appDataPath\Microsoft\Internet Explorer\Quick Launch\Microsoft Edge.lnk" -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Revert settings related to Microsoft Edge
|
||||
foreach ($sid in $users) {
|
||||
foreach ($packageName in $eol) {
|
||||
Remove-Item -Path "$store\EndOfLife\$sid\$packageName" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# Set policies to prevent unsolicited reinstalls of Microsoft Edge
|
||||
$registryPaths = @('HKLM:\SOFTWARE\Policies', 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\WOW6432Node')
|
||||
$edgeUpdatePolicies = @{
|
||||
'InstallDefault' = 0;
|
||||
'Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' = 0;
|
||||
'Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' = 1;
|
||||
'DoNotUpdateToEdgeWithChromium' = 1;
|
||||
}
|
||||
|
||||
foreach ($path in $registryPaths) {
|
||||
New-Item -Path "$path\Microsoft\EdgeUpdate" -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
foreach ($policy in $edgeUpdatePolicies.GetEnumerator()) {
|
||||
Set-ItemProperty -Path "$path\Microsoft\EdgeUpdate" -Name $policy.Key -Value $policy.Value -Type Dword -Force
|
||||
}
|
||||
}
|
||||
|
||||
$edgeUpdateActions = @('on-os-upgrade', 'on-logon', 'on-logon-autolaunch', 'on-logon-startup-boost')
|
||||
$edgeUpdateClients = @(
|
||||
'Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}',
|
||||
'Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
|
||||
)
|
||||
foreach ($client in $edgeUpdateClients) {
|
||||
foreach ($action in $edgeUpdateActions) {
|
||||
foreach ($regBase in 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\Wow6432Node') {
|
||||
$regPath = "$regBase\$client\Commands\$action"
|
||||
New-Item -Path $regPath -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
Set-ItemProperty -Path $regPath -Name 'CommandLine' -Value 'systray.exe' -Force
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
## Redirect Edge Shortcuts
|
||||
|
||||
# Define Microsoft Edge Paths
|
||||
$MSEP = ($env:ProgramFiles, ${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem] + '\Microsoft\Edge\Application'
|
||||
$IFEO = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options'
|
||||
$MIN = ('--headless', '--width 1 --height 1')[([environment]::OSVersion.Version.Build) -gt 25179]
|
||||
$CMD = "$env:systemroot\system32\conhost.exe $MIN"
|
||||
$DIR = "$env:SystemDrive\Scripts"
|
||||
|
||||
# Setup Microsoft Edge Registry Entries
|
||||
New-Item -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Force | Out-Null
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge" -Name '(Default)' -Value 'URL:microsoft-edge' -Force
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge" -Name 'URL Protocol' -Value '' -Force
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge" -Name 'NoOpenWith' -Value '' -Force
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Name '(Default)' -Value "`"$DIR\ie_to_edge_stub.exe`" %1" -Force
|
||||
|
||||
# Setup MSEdgeHTM Registry Entries
|
||||
New-Item -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Force | Out-Null
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM" -Name 'NoOpenWith' -Value '' -Force
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Name '(Default)' -Value "`"$DIR\ie_to_edge_stub.exe`" %1" -Force
|
||||
|
||||
# Setup Image File Execution Options for Edge and Edge WebView
|
||||
$exeSettings = @(
|
||||
@{ ExeName = 'ie_to_edge_stub.exe'; Debugger = "$CMD $DIR\OpenWebSearch.cmd"; FilterPath = "$DIR\ie_to_edge_stub.exe" },
|
||||
@{ ExeName = 'msedge.exe'; Debugger = "$CMD $DIR\OpenWebSearch.cmd"; FilterPath = "$MSEP\msedge.exe" }
|
||||
)
|
||||
|
||||
foreach ($setting in $exeSettings) {
|
||||
New-Item -Path "$IFEO\$($setting.ExeName)\0" -Force | Out-Null
|
||||
Set-ItemProperty -Path "$IFEO\$($setting.ExeName)" -Name 'UseFilter' -Value 1 -Type Dword -Force
|
||||
Set-ItemProperty -Path "$IFEO\$($setting.ExeName)\0" -Name 'FilterFullPath' -Value $setting.FilterPath -Force
|
||||
Set-ItemProperty -Path "$IFEO\$($setting.ExeName)\0" -Name 'Debugger' -Value $setting.Debugger -Force
|
||||
}
|
||||
|
||||
# Write OpenWebSearch Batch Script
|
||||
$OpenWebSearch = @'
|
||||
@echo off
|
||||
@title OpenWebSearch Redux
|
||||
|
||||
:: Minimize prompt
|
||||
for /f %%E in ('"prompt $E$S & for %%e in (1) do rem"') do echo;%%E[2t >nul 2>&1
|
||||
|
||||
:: Get default browser from registry
|
||||
call :get_registry_value "HKCU\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" ProgID DefaultBrowser
|
||||
if not defined DefaultBrowser (
|
||||
echo Error: Failed to get default browser from registry.
|
||||
pause
|
||||
exit /b
|
||||
)
|
||||
if /i "%DefaultBrowser%" equ "MSEdgeHTM" (
|
||||
echo Error: Default browser is set to Edge! Change it or remove OpenWebSearch script.
|
||||
pause
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Get browser command line
|
||||
call :get_registry_value "HKCR\%DefaultBrowser%\shell\open\command" "" BrowserCommand
|
||||
if not defined BrowserCommand (
|
||||
echo Error: Failed to get browser command from registry.
|
||||
pause
|
||||
exit /b
|
||||
)
|
||||
set Browser=& for %%i in (%BrowserCommand%) do if not defined Browser set "Browser=%%~i"
|
||||
|
||||
:: Set fallback for Edge
|
||||
call :get_registry_value "HKCR\MSEdgeMHT\shell\open\command" "" FallBack
|
||||
set EdgeCommand=& for %%i in (%FallBack%) do if not defined EdgeCommand set "EdgeCommand=%%~i"
|
||||
|
||||
:: Parse command line arguments and check for redirect or noop conditions
|
||||
set "URI=" & set "URL=" & set "NOOP=" & set "PassThrough=%EdgeCommand:msedge=edge%"
|
||||
set "CommandLineArgs=%CMDCMDLINE:"=``% "
|
||||
call :parse_arguments
|
||||
|
||||
if defined NOOP (
|
||||
if not exist "%PassThrough%" (
|
||||
echo Error: PassThrough path doesn't exist.
|
||||
pause
|
||||
exit /b
|
||||
)
|
||||
start "" "%PassThrough%" %ParsedArgs%
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Decode URL
|
||||
call :decode_url
|
||||
if not defined URL (
|
||||
echo Error: Failed to decode URL.
|
||||
pause
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Open URL in default browser
|
||||
start "" "%Browser%" "%URL%"
|
||||
exit
|
||||
|
||||
:: Functions
|
||||
|
||||
:get_registry_value
|
||||
setlocal
|
||||
set regQuery=reg query "%~1" /v %2 /z /se "," /f /e
|
||||
if "%~2" equ "" set regQuery=reg query "%~1" /ve /z /se "," /f /e
|
||||
for /f "skip=2 tokens=* delims=" %%V in ('%regQuery% 2^>nul') do set "result=%%V"
|
||||
if defined result (set "result=%result:*) =%") else (set "%~3=")
|
||||
endlocal & set "%~3=%result%"
|
||||
exit /b
|
||||
|
||||
:decode_url
|
||||
:: Brute URL percent decoding
|
||||
setlocal enabledelayedexpansion
|
||||
set "decoded=%URL:!=}%"
|
||||
call :brute_decode
|
||||
endlocal & set "URL=%decoded%"
|
||||
exit /b
|
||||
|
||||
:parse_arguments
|
||||
:: Remove specific substrings from arguments
|
||||
set "CommandLineArgs=%CommandLineArgs:*ie_to_edge_stub.exe`` =%"
|
||||
set "CommandLineArgs=%CommandLineArgs:*ie_to_edge_stub.exe =%"
|
||||
set "CommandLineArgs=%CommandLineArgs:*msedge.exe`` =%"
|
||||
set "CommandLineArgs=%CommandLineArgs:*msedge.exe =%"
|
||||
|
||||
:: Remove any trailing spaces
|
||||
if "%CommandLineArgs:~-1%"==" " set "CommandLineArgs=%CommandLineArgs:~0,-1%"
|
||||
|
||||
:: Check if arguments are a redirect or URL
|
||||
set "RedirectArg=%CommandLineArgs:microsoft-edge=%"
|
||||
set "UrlArg=%CommandLineArgs:http=%"
|
||||
set "ParsedArgs=%CommandLineArgs:``="%"
|
||||
|
||||
:: Set NOOP flag if no changes to arguments
|
||||
if "%CommandLineArgs%" equ "%RedirectArg%" (set NOOP=1) else if "%CommandLineArgs%" equ "%UrlArg%" (set NOOP=1)
|
||||
|
||||
:: Extract URL if present
|
||||
if not defined NOOP (
|
||||
set "URL=%CommandLineArgs:*microsoft-edge=%"
|
||||
set "URL=http%URL:*http=%"
|
||||
if "%URL:~-2%"=="``" set "URL=%URL:~0,-2%"
|
||||
)
|
||||
exit /b
|
||||
|
||||
|
||||
:brute_decode
|
||||
:: Brute force URL percent decoding
|
||||
|
||||
set "decoded=%decoded:%%20= %"
|
||||
set "decoded=%decoded:%%21=!!"
|
||||
set "decoded=%decoded:%%22="%""
|
||||
set "decoded=%decoded:%%23=#%"
|
||||
set "decoded=%decoded:%%24=$%"
|
||||
set "decoded=%decoded:%%25=%%%"
|
||||
set "decoded=%decoded:%%26=&%"
|
||||
set "decoded=%decoded:%%27='%"
|
||||
set "decoded=%decoded:%%28=(%"
|
||||
set "decoded=%decoded:%%29=)%"
|
||||
set "decoded=%decoded:%%2A=*%"
|
||||
set "decoded=%decoded:%%2B=+%"
|
||||
set "decoded=%decoded:%%2C=,%"
|
||||
set "decoded=%decoded:%%2D=-%"
|
||||
set "decoded=%decoded:%%2E=.%"
|
||||
set "decoded=%decoded:%%2F=/%"
|
||||
:: ... Continue for other encodings ...
|
||||
|
||||
:: Correct any double percentage signs
|
||||
set "decoded=%decoded:%%%%=%"
|
||||
|
||||
exit /b
|
||||
|
||||
|
||||
|
||||
'@
|
||||
[io.file]::WriteAllText("$DIR\OpenWebSearch.cmd", $OpenWebSearch)
|
||||
|
||||
|
||||
# Final Steps
|
||||
|
||||
# Retrieve the Edge_Removal property from the specified registry paths
|
||||
$userRegPaths = Get-ChildItem -Path 'Registry::HKEY_Users\S-1-5-21*\Volatile*' -ErrorAction SilentlyContinue
|
||||
$edgeRemovalPath = $userRegPaths | Get-ItemProperty -Name 'Edge_Removal' -ErrorAction SilentlyContinue
|
||||
|
||||
# If the Edge_Removal property exists, remove it
|
||||
if ($edgeRemovalPath) {
|
||||
Remove-ItemProperty -Path $edgeRemovalPath.PSPath -Name 'Edge_Removal' -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Ensure the explorer process is running
|
||||
if (-not (Get-Process -Name 'explorer' -ErrorAction SilentlyContinue)) {
|
||||
Start-Process 'explorer'
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,13 +2,19 @@ Function Get-WinUtilCheckBoxes {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Function is meant to find all checkboxes that are checked on the specific tab and input them into a script.
|
||||
.SYNOPSIS
|
||||
Finds all checkboxes that are checked on the specific tab and inputs them into a script.
|
||||
|
||||
Outputed data will be the names of the checkboxes that were checked
|
||||
.PARAMETER Group
|
||||
The group of checkboxes to check
|
||||
|
||||
.PARAMETER unCheck
|
||||
Whether to uncheck the checkboxes that are checked. Defaults to true
|
||||
|
||||
.OUTPUTS
|
||||
A List containing the name of each checked checkbox
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Get-WinUtilCheckBoxes "WPFInstall"
|
||||
|
||||
#>
|
||||
|
@ -1,8 +1,14 @@
|
||||
function Get-WinUtilInstallerProcess {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Meant to check for running processes and will return a boolean response
|
||||
.SYNOPSIS
|
||||
Checks if the given process is running
|
||||
|
||||
.PARAMETER Process
|
||||
The process to check
|
||||
|
||||
.OUTPUTS
|
||||
Boolean - True if the process is running
|
||||
|
||||
#>
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
function Get-WinUtilRegistry {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will make all modifications to the registry
|
||||
.SYNOPSIS
|
||||
Gets the value of a registry key
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
||||
Get-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
||||
|
||||
#>
|
||||
param (
|
||||
|
@ -1,11 +1,14 @@
|
||||
Function Get-WinUtilToggleStatus {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Meant to pull the registry keys for a toggle switch and returns true or false
|
||||
.SYNOPSIS
|
||||
Pulls the registry keys for the given toggle switch and checks whether the toggle should be checked or unchecked
|
||||
|
||||
True should mean status is enabled
|
||||
False should mean status is disabled
|
||||
.PARAMETER ToggleSwitch
|
||||
The name of the toggle to check
|
||||
|
||||
.OUTPUTS
|
||||
Boolean to set the toggle's status to
|
||||
|
||||
#>
|
||||
|
||||
|
@ -2,8 +2,11 @@ function Get-WinUtilVariables {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
placeholder
|
||||
.SYNOPSIS
|
||||
Gets every form object of the provided type
|
||||
|
||||
.OUTPUTS
|
||||
List containing every object that matches the provided type
|
||||
|
||||
#>
|
||||
param (
|
||||
|
@ -2,8 +2,8 @@ function Install-WinUtilChoco {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Function is meant to ensure Choco is installed
|
||||
.SYNOPSIS
|
||||
Installs Chocolatey if it is not already installed
|
||||
|
||||
#>
|
||||
|
||||
@ -15,16 +15,15 @@ function Install-WinUtilChoco {
|
||||
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)"
|
||||
if ($confirmation -eq 'y') {
|
||||
Write-Host "Seems Chocolatey is not installed, installing now"
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
|
||||
powershell choco feature enable -n allowGlobalConfirmation
|
||||
}
|
||||
|
||||
}
|
||||
Catch {
|
||||
throw [ChocoFailedInstall]::new('Failed to install')
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Chocolatey failed to install ---"
|
||||
Write-Host "==========================================="
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,17 @@ Function Install-WinUtilProgramWinget {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This will install programs via Winget using a new powershell.exe instance to prevent the GUI from locking up.
|
||||
.SYNOPSIS
|
||||
Manages the provided programs using Winget
|
||||
|
||||
Note the triple quotes are required any time you need a " in a normal script block.
|
||||
.PARAMETER ProgramsToInstall
|
||||
A list of programs to manage
|
||||
|
||||
.PARAMETER manage
|
||||
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
|
||||
|
||||
.NOTES
|
||||
The triple quotes are required any time you need a " in a normal script block.
|
||||
|
||||
#>
|
||||
|
||||
|
@ -11,8 +11,8 @@ function Install-WinUtilWinget {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Function is meant to ensure winget is installed
|
||||
.SYNOPSIS
|
||||
Installs Winget if it is not already installed
|
||||
|
||||
#>
|
||||
Try{
|
||||
@ -38,7 +38,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"
|
||||
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget"
|
||||
|
||||
Write-Host "Winget Installed"
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
function Invoke-WinUtilBingSearch {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Sets Bing Search on or off
|
||||
.SYNOPSIS
|
||||
Disables/Enables Bing Search
|
||||
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Bing Search
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
|
@ -2,13 +2,10 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Function is meant to read existing system registry and check according configuration.
|
||||
|
||||
Example: Is telemetry enabled? check the box.
|
||||
.SYNOPSIS
|
||||
Checks to see what tweaks have already been applied and what programs are installed, and checks the according boxes
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Get-WinUtilCheckBoxes "WPFInstall"
|
||||
|
||||
#>
|
||||
|
@ -1,8 +1,11 @@
|
||||
Function Invoke-WinUtilDarkMode {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Sets Dark Mode on or off
|
||||
.SYNOPSIS
|
||||
Enables/Disables Dark Mode
|
||||
|
||||
.PARAMETER DarkMoveEnabled
|
||||
Indicates the current dark mode state
|
||||
|
||||
#>
|
||||
Param($DarkMoveEnabled)
|
||||
|
@ -1,8 +1,8 @@
|
||||
function Invoke-WinUtilFeatureInstall {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function converts all the values from the tweaks.json and routes them to the appropriate function
|
||||
.SYNOPSIS
|
||||
Converts all the values from the tweaks.json and routes them to the appropriate function
|
||||
|
||||
#>
|
||||
|
||||
|
@ -1,11 +1,16 @@
|
||||
function Invoke-WinUtilScript {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will run a separate powershell script. Meant for things that can't be handled with the other functions
|
||||
.SYNOPSIS
|
||||
Invokes the provided scriptblock. Intended for things that can't be handled with the other functions.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the scriptblock being invoked
|
||||
|
||||
.PARAMETER scriptblock
|
||||
The scriptblock to be invoked
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
$Scriptblock = [scriptblock]::Create({"Write-output 'Hello World'"})
|
||||
Invoke-WinUtilScript -ScriptBlock $scriptblock -Name "Hello World"
|
||||
|
||||
|
@ -1,8 +1,14 @@
|
||||
function Invoke-WinUtilTweaks {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function converts all the values from the tweaks.json and routes them to the appropriate function
|
||||
.SYNOPSIS
|
||||
Invokes the function associated with each provided checkbox
|
||||
|
||||
.PARAMETER CheckBox
|
||||
The checkbox to invoke
|
||||
|
||||
.PARAMETER undo
|
||||
Indicates whether to undo the operation contained in the checkbox
|
||||
|
||||
#>
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
function Remove-WinUtilAPPX {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will remove any of the provided APPX names
|
||||
.SYNOPSIS
|
||||
Removes all APPX packages that match the given name
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the APPX package to remove
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Remove-WinUtilAPPX -Name "Microsoft.Microsoft3DViewer"
|
||||
|
||||
#>
|
||||
|
@ -1,11 +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
|
||||
.SYNOPSIS
|
||||
Sets the DNS of all interfaces that are in the "Up" state. It will lookup the values from the DNS.Json file
|
||||
|
||||
.PARAMETER DNSProvider
|
||||
The DNS provider to set the DNS server to
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilDNS -DNSProvider "google"
|
||||
|
||||
#>
|
||||
|
@ -1,11 +1,22 @@
|
||||
function Set-WinUtilRegistry {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will make all modifications to the registry
|
||||
.SYNOPSIS
|
||||
Modifies the registry based on the given inputs
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the key to modify
|
||||
|
||||
.PARAMETER Path
|
||||
The path to the key
|
||||
|
||||
.PARAMETER Type
|
||||
The type of value to set the key to
|
||||
|
||||
.PARAMETER Value
|
||||
The value to set the key to
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
||||
|
||||
#>
|
||||
|
@ -1,8 +1,8 @@
|
||||
function Set-WinUtilRestorePoint {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will make a Restore Point
|
||||
.SYNOPSIS
|
||||
Creates a Restore Point
|
||||
|
||||
#>
|
||||
|
||||
|
@ -1,11 +1,16 @@
|
||||
function Set-WinUtilScheduledTask {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will enable/disable the provided Scheduled Task
|
||||
.SYNOPSIS
|
||||
Enables/Disables the provided Scheduled Task
|
||||
|
||||
.PARAMETER Name
|
||||
The path to the Scheduled Task
|
||||
|
||||
.PARAMETER State
|
||||
The State to set the Task to
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilScheduledTask -Name "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" -State "Disabled"
|
||||
|
||||
#>
|
||||
|
@ -1,11 +1,16 @@
|
||||
Function Set-WinUtilService {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will change the startup type of services and start/stop them as needed
|
||||
.SYNOPSIS
|
||||
Changes the startup type of the given service
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the service to modify
|
||||
|
||||
.PARAMETER StartupType
|
||||
The startup type to set the service to
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilService -Name "HomeGroupListener" -StartupType "Manual"
|
||||
|
||||
#>
|
||||
|
@ -1,11 +1,16 @@
|
||||
function Set-WinUtilUITheme {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will set theme to the XAML file
|
||||
.SYNOPSIS
|
||||
Sets the theme of the XAML file
|
||||
|
||||
.PARAMETER inputXML
|
||||
A string representing the XAML object to modify
|
||||
|
||||
.PARAMETER themeName
|
||||
The name of the theme to set the XAML to. Defaults to 'matrix'
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilUITheme -inputXAML $inputXAML
|
||||
|
||||
#>
|
||||
|
@ -1,8 +1,14 @@
|
||||
function Test-WinUtilPackageManager {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Checks for Winget or Choco depending on the parameter
|
||||
.SYNOPSIS
|
||||
Checks if Winget and/or Choco are installed
|
||||
|
||||
.PARAMETER winget
|
||||
Check if Winget is installed
|
||||
|
||||
.PARAMETER choco
|
||||
Check if Chocolatey is installed
|
||||
|
||||
#>
|
||||
|
||||
|
@ -2,8 +2,8 @@ Function Update-WinUtilProgramWinget {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This will update programs via Winget using a new powershell.exe instance to prevent the GUI from locking up.
|
||||
.SYNOPSIS
|
||||
This will update all programs using Winget
|
||||
|
||||
#>
|
||||
|
||||
|
@ -2,11 +2,12 @@ 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.
|
||||
.SYNOPSIS
|
||||
Invokes the function associated with the clicked button
|
||||
|
||||
.PARAMETER Button
|
||||
The name of the button that was clicked
|
||||
|
||||
Input will be the name of the button that is clicked.
|
||||
#>
|
||||
|
||||
Param ([string]$Button)
|
||||
|
@ -1,8 +1,11 @@
|
||||
function Invoke-WPFControlPanel {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Simple Switch for legacy windows
|
||||
.SYNOPSIS
|
||||
Opens the requested legacy panel
|
||||
|
||||
.PARAMETER Panel
|
||||
The panel to open
|
||||
|
||||
#>
|
||||
param($Panel)
|
||||
|
@ -1,8 +1,8 @@
|
||||
function Invoke-WPFFeatureInstall {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
GUI Function to install Windows Features
|
||||
.SYNOPSIS
|
||||
Installs selected Windows Features
|
||||
|
||||
#>
|
||||
|
||||
|
@ -1,14 +1,18 @@
|
||||
function Invoke-WPFFixesNetwork {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Resets various network configurations
|
||||
|
||||
#>
|
||||
|
||||
Write-Host "Resetting Network with netsh"
|
||||
|
||||
# Reset WinSock catalog to a clean state
|
||||
Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "winsock", "reset"
|
||||
# Resets WinHTTP proxy setting to DIRECT
|
||||
Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "winhttp", "reset", "proxy"
|
||||
# Removes all user configured IP settings
|
||||
Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "int", "ip", "reset"
|
||||
|
||||
Write-Host "Process complete. Please reboot your computer."
|
||||
@ -19,7 +23,7 @@ function Invoke-WPFFixesNetwork {
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
Write-Host "================================="
|
||||
Write-Host "-- Reset Network Configuration --"
|
||||
Write-Host "================================="
|
||||
Write-Host "=========================================="
|
||||
Write-Host "-- Network Configuration has been Reset --"
|
||||
Write-Host "=========================================="
|
||||
}
|
@ -2,12 +2,12 @@ function Invoke-WPFFixesUpdate {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Performs various tasks in an attempt to repair Windows Update
|
||||
|
||||
#>
|
||||
|
||||
### Reset Windows Update Script - reregister dlls, services, and remove registry entries.
|
||||
# Reset Windows Update Script - reregister dlls, services, and remove registry entries
|
||||
Write-Host "1. Stopping Windows Update Services..."
|
||||
Stop-Service -Name BITS
|
||||
Stop-Service -Name wuauserv
|
||||
@ -83,7 +83,7 @@ Write-Host "12) Forcing discovery..."
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
Write-Host "================================="
|
||||
Write-Host "-- Reset ALL Updates to Factory -"
|
||||
Write-Host "================================="
|
||||
Write-Host "==============================================="
|
||||
Write-Host "-- Reset All Windows Update Settings to Stock -"
|
||||
Write-Host "==============================================="
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
Function Invoke-WPFFormVariables {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Prints the logo
|
||||
|
||||
#>
|
||||
#If ($global:ReadmeDisplay -ne $true) { Write-Host "If you need to reference this display again, run Get-FormVariables" -ForegroundColor Yellow; $global:ReadmeDisplay = $true }
|
||||
|
@ -1,8 +1,11 @@
|
||||
function Invoke-WPFGetInstalled {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
placeholder
|
||||
.SYNOPSIS
|
||||
Invokes the function that gets the checkboxes to check in a new runspace
|
||||
|
||||
.PARAMETER checkbox
|
||||
Indicates whether to check for installed 'winget' programs or applied 'tweaks'
|
||||
|
||||
#>
|
||||
param($checkbox)
|
||||
|
@ -1,11 +1,16 @@
|
||||
function Invoke-WPFImpex {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function handles importing and exporting of the checkboxes checked for the tweaks section
|
||||
.SYNOPSIS
|
||||
Handles importing and exporting of the checkboxes checked for the tweaks section
|
||||
|
||||
.PARAMETER type
|
||||
Indicates whether to 'import' or 'export'
|
||||
|
||||
.PARAMETER checkbox
|
||||
The checkbox to export to a file or apply the imported file to
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Invoke-WPFImpex -type "export"
|
||||
|
||||
#>
|
||||
|
@ -1,8 +1,8 @@
|
||||
function Invoke-WPFInstall {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Installs the selected programs using winget
|
||||
|
||||
#>
|
||||
|
||||
@ -28,7 +28,7 @@ function Invoke-WPFInstall {
|
||||
# Ensure winget is installed
|
||||
Install-WinUtilWinget
|
||||
|
||||
# Install all winget programs in new window
|
||||
# Install all selected programs in new window
|
||||
Install-WinUtilProgramWinget -ProgramsToInstall $WingetInstall
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
|
@ -1,8 +1,8 @@
|
||||
function Invoke-WPFInstallUpgrade {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Invokes the function that upgrades all installed programs using winget
|
||||
|
||||
#>
|
||||
if(!(Test-WinUtilPackageManager -winget)){
|
||||
|
@ -1,8 +1,8 @@
|
||||
function Invoke-WPFPanelAutologin {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Enables autologin using Sysinternals Autologon.exe
|
||||
|
||||
#>
|
||||
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
|
||||
|
@ -1,8 +1,25 @@
|
||||
function Invoke-WPFPanelDISM {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Checks for system corruption using Chkdsk, SFC, and DISM
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
1. Chkdsk - Fixes disk and filesystem corruption
|
||||
2. SFC Run 1 - Fixes system file corruption, and fixes DISM if it was corrupted
|
||||
3. DISM - Fixes system image corruption, and fixes SFC's system image if it was corrupted
|
||||
4. SFC Run 2 - Fixes system file corruption, this time with an almost guaranteed uncorrupted system image
|
||||
|
||||
.NOTES
|
||||
Command Arguments:
|
||||
1. Chkdsk
|
||||
/Scan - Runs an online scan on the system drive, attempts to fix any corruption, and queues other corruption for fixing on reboot
|
||||
2. SFC
|
||||
/ScanNow - Performs a scan of the system files and fixes any corruption
|
||||
3. DISM - Fixes system image corruption, and fixes SFC's system image if it was corrupted
|
||||
/Online - Fixes the currently running system image
|
||||
/Cleanup-Image - Performs cleanup operations on the image, could remove some unneeded temporary files
|
||||
/Restorehealth - Performs a scan of the image and fixes any corruption
|
||||
|
||||
#>
|
||||
Start-Process PowerShell -ArgumentList "Write-Host '(1/4) Chkdsk' -ForegroundColor Green; Chkdsk /scan;
|
||||
|
@ -1,8 +1,17 @@
|
||||
function Invoke-WPFPresets {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Meant to make settings presets easier in the tweaks tab. Will pull the data from config/preset.json
|
||||
.SYNOPSIS
|
||||
Sets the options in the tweaks panel to the given preset
|
||||
|
||||
.PARAMETER preset
|
||||
The preset to set the options to
|
||||
|
||||
.PARAMETER imported
|
||||
If the preset is imported from a file, defaults to false
|
||||
|
||||
.PARAMETER checkbox
|
||||
The checkbox to set the options to, defaults to 'WPFTweaks'
|
||||
|
||||
#>
|
||||
|
||||
|
@ -2,18 +2,19 @@ function Invoke-WPFRunspace {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Simple function to make it easier to invoke a runspace from inside the script.
|
||||
.SYNOPSIS
|
||||
Creates and invokes a runspace using the given scriptblock and argumentlist
|
||||
|
||||
.PARAMETER ScriptBlock
|
||||
The scriptblock to invoke in the runspace
|
||||
|
||||
.PARAMETER ArgumentList
|
||||
A list of arguments to pass to the runspace
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
$params = @{
|
||||
ScriptBlock = $sync.ScriptsInstallPrograms
|
||||
ArgumentList = "Installadvancedip,Installbitwarden"
|
||||
Verbose = $true
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace @params
|
||||
Invoke-WPFRunspace `
|
||||
-ScriptBlock $sync.ScriptsInstallPrograms `
|
||||
-ArgumentList "Installadvancedip,Installbitwarden" `
|
||||
|
||||
#>
|
||||
|
||||
@ -23,7 +24,7 @@ function Invoke-WPFRunspace {
|
||||
$ArgumentList
|
||||
)
|
||||
|
||||
#Crate a PowerShell instance.
|
||||
# Create a PowerShell instance
|
||||
$script:powershell = [powershell]::Create()
|
||||
|
||||
# Add Scriptblock and Arguments to runspace
|
||||
@ -31,10 +32,10 @@ function Invoke-WPFRunspace {
|
||||
$script:powershell.AddArgument($ArgumentList)
|
||||
$script:powershell.RunspacePool = $sync.runspace
|
||||
|
||||
#Run our RunspacePool.
|
||||
# Execute the RunspacePool
|
||||
$script:handle = $script:powershell.BeginInvoke()
|
||||
|
||||
#Cleanup our RunspacePool threads when they are complete ie. GC.
|
||||
# Clean up the RunspacePool threads when they are complete, and invoke the garbage collector to clean up the memory
|
||||
if ($script:handle.IsCompleted)
|
||||
{
|
||||
$script:powershell.EndInvoke($script:handle)
|
||||
|
@ -1,8 +1,11 @@
|
||||
function Invoke-WPFShortcut {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Creates a shortcut
|
||||
.SYNOPSIS
|
||||
Creates a shortcut and prompts for a save location
|
||||
|
||||
.PARAMETER ShortcutToAdd
|
||||
The name of the shortcut to add
|
||||
|
||||
#>
|
||||
param($ShortcutToAdd)
|
||||
|
@ -2,8 +2,11 @@ function Invoke-WPFTab {
|
||||
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
Sole purpose of this function is to reduce duplicated code for switching between tabs.
|
||||
.SYNOPSIS
|
||||
Sets the selected tab to the tab that was clicked
|
||||
|
||||
.PARAMETER ClickedTab
|
||||
The name of the tab that was clicked
|
||||
|
||||
#>
|
||||
|
||||
|
@ -2,11 +2,12 @@ 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.
|
||||
.SYNOPSIS
|
||||
Invokes the scriptblock for the given toggle
|
||||
|
||||
.PARAMETER Button
|
||||
The name of the toggle to invoke
|
||||
|
||||
Input will be the name of the toggle that is checked.
|
||||
#>
|
||||
|
||||
Param ([string]$Button)
|
||||
|
@ -1,31 +1,36 @@
|
||||
Function Invoke-WPFUltimatePerformance {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Creates or removes the Ultimate Performance power scheme
|
||||
|
||||
.PARAMETER State
|
||||
Indicates whether to enable or disable the Ultimate Performance power scheme
|
||||
|
||||
#>
|
||||
param($State)
|
||||
Try{
|
||||
|
||||
if($state -eq "Enabled"){
|
||||
# Define the name and GUID of the power scheme you want to add
|
||||
# Define the name and GUID of the power scheme
|
||||
$powerSchemeName = "Ultimate Performance"
|
||||
$powerSchemeGuid = "e9a42b02-d5df-448d-aa00-03f14749eb61"
|
||||
|
||||
# Get all power schemes
|
||||
$schemes = powercfg /list | Out-String -Stream
|
||||
|
||||
# Find the scheme you want to add
|
||||
# Check if the power scheme already exists
|
||||
$ultimateScheme = $schemes | Where-Object { $_ -match $powerSchemeName }
|
||||
|
||||
# If the scheme does not exist, add it
|
||||
if ($null -eq $ultimateScheme) {
|
||||
Write-Host "Power scheme '$powerSchemeName' not found. Adding..."
|
||||
|
||||
# Add the power scheme
|
||||
powercfg /duplicatescheme $powerSchemeGuid
|
||||
powercfg -attributes SUB_SLEEP 7bc4a2f9-d8fc-4469-b07b-33eb785aaca0 -ATTRIB_HIDE
|
||||
powercfg -setactive $powerSchemeGuid
|
||||
powercfg -change -monitor-timeout-ac 0
|
||||
|
||||
|
||||
Write-Host "Power scheme added successfully."
|
||||
}
|
||||
@ -34,13 +39,13 @@ Function Invoke-WPFUltimatePerformance {
|
||||
}
|
||||
}
|
||||
elseif($state -eq "Disabled"){
|
||||
# Define the name of the power scheme you want to remove
|
||||
# Define the name of the power scheme
|
||||
$powerSchemeName = "Ultimate Performance"
|
||||
|
||||
# Get all power schemes
|
||||
$schemes = powercfg /list | Out-String -Stream
|
||||
|
||||
# Find the scheme you want to remove
|
||||
# Find the scheme to be removed
|
||||
$ultimateScheme = $schemes | Where-Object { $_ -match $powerSchemeName }
|
||||
|
||||
# If the scheme exists, remove it
|
||||
|
@ -1,13 +1,13 @@
|
||||
function Invoke-WPFUnInstall {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Uninstalls the selected programs
|
||||
|
||||
#>
|
||||
|
||||
if($sync.ProcessRunning){
|
||||
$msg = "Install process is currently running."
|
||||
$msg = "Install process is currently running"
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
@ -22,7 +22,7 @@ function Invoke-WPFUnInstall {
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::YesNo
|
||||
$MessageboxTitle = "Are you sure?"
|
||||
$Messageboxbody = ("This will uninstall the following applications `n $WingetInstall")
|
||||
$Messageboxbody = ("This will uninstall the following applications: `n $WingetInstall")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
$confirm = [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
@ -34,7 +34,7 @@ function Invoke-WPFUnInstall {
|
||||
try{
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
# Install all winget programs in new window
|
||||
# Install all selected programs in new window
|
||||
Install-WinUtilProgramWinget -ProgramsToInstall $WingetInstall -Manage "Uninstalling"
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
|
@ -1,8 +1,8 @@
|
||||
function Invoke-WPFUpdatesdefault {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Resets Windows Update settings to default
|
||||
|
||||
#>
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
|
||||
@ -39,7 +39,7 @@ function Invoke-WPFUpdatesdefault {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "BranchReadinessLevel" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferFeatureUpdatesPeriodInDays" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferQualityUpdatesPeriodInDays" -ErrorAction SilentlyContinue
|
||||
Write-Host "================================="
|
||||
Write-Host "--- Updates Set to Default ---"
|
||||
Write-Host "================================="
|
||||
Write-Host "==================================================="
|
||||
Write-Host "--- Windows Update Settings Reset to Default ---"
|
||||
Write-Host "==================================================="
|
||||
}
|
@ -1,8 +1,11 @@
|
||||
function Invoke-WPFUpdatesdisable {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Disables Windows Update
|
||||
|
||||
.NOTES
|
||||
Disabling Windows Update is not recommended. This is only for advanced users who know what they are doing.
|
||||
|
||||
#>
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
|
||||
|
@ -1,8 +1,15 @@
|
||||
function Invoke-WPFUpdatessecurity {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Sets Windows Update to recommended settings
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
1. Disables driver offering through Windows Update
|
||||
2. Disables Windows Update automatic restart
|
||||
3. Sets Windows Update to Semi-Annual Channel (Targeted)
|
||||
4. Defers feature updates for 365 days
|
||||
5. Defers quality updates for 4 days
|
||||
|
||||
#>
|
||||
Write-Host "Disabling driver offering through Windows Update..."
|
||||
|
@ -1,8 +1,8 @@
|
||||
function Invoke-WPFtweaksbutton {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Invokes the functions associated with each group of checkboxes
|
||||
|
||||
#>
|
||||
|
||||
@ -22,13 +22,13 @@ function Invoke-WPFtweaksbutton {
|
||||
return
|
||||
}
|
||||
|
||||
Set-WinUtilRestorePoint
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks -ScriptBlock {
|
||||
param($Tweaks)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
Set-WinUtilRestorePoint
|
||||
|
||||
Foreach ($tweak in $tweaks){
|
||||
Invoke-WinUtilTweaks $tweak
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
function Invoke-WPFundoall {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
PlaceHolder
|
||||
.SYNOPSIS
|
||||
Undoes every selected tweak
|
||||
|
||||
#>
|
||||
|
||||
|
4
gpedit-home.ps1
Normal file
4
gpedit-home.ps1
Normal file
@ -0,0 +1,4 @@
|
||||
Get-ChildItem @(
|
||||
"C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package*.mum",
|
||||
"C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package*.mum"
|
||||
) | ForEach-Object { dism.exe /online /norestart /add-package:"$_" }
|
@ -1,14 +1,10 @@
|
||||
#region Load Variables needed for testing
|
||||
|
||||
#Config Files
|
||||
# Import Config Files
|
||||
$global:importedconfigs = @{}
|
||||
Get-ChildItem .\config | Where-Object {$_.Extension -eq ".json"} | ForEach-Object {
|
||||
$global:importedconfigs[$psitem.BaseName] = Get-Content $psitem.FullName | ConvertFrom-Json
|
||||
}
|
||||
|
||||
|
||||
#endregion Load Variables needed for testing
|
||||
|
||||
#===========================================================================
|
||||
# Tests - Application Installs
|
||||
#===========================================================================
|
||||
|
@ -16,10 +16,6 @@ Describe "Functions"{
|
||||
fullname = $psitem.FullName
|
||||
} {
|
||||
Get-ChildItem function:\$basename | should -Not -BeNullOrEmpty
|
||||
}
|
||||
It "Contains Description" -TestCases @{
|
||||
basename = $($psitem.BaseName)
|
||||
fullname = $psitem.FullName
|
||||
} {
|
||||
get-help $basename -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Description | should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
#region Load Variables needed for testing
|
||||
# Load Variables needed for testing
|
||||
|
||||
./Compile.ps1
|
||||
|
||||
$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
|
||||
|
||||
|
||||
#endregion Load Variables needed for testing
|
||||
|
||||
BeforeAll {
|
||||
# Execute the truncated script, bringing the variabes into the current scope
|
||||
. .\pester.ps1
|
||||
}
|
||||
|
||||
|
@ -1,32 +1,36 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
#Configure max thread count for RunspacePool.
|
||||
# Set the maximum number of threads for the RunspacePool to the number of threads on the machine
|
||||
$maxthreads = [int]$env:NUMBER_OF_PROCESSORS
|
||||
|
||||
#Create a new session state for parsing variables ie hashtable into our runspace.
|
||||
# Create a new session state for parsing variables into our runspace
|
||||
$hashVars = New-object System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList 'sync',$sync,$Null
|
||||
$InitialSessionState = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault()
|
||||
|
||||
#Add the variable to the RunspacePool sessionstate
|
||||
# Add the variable to the session state
|
||||
$InitialSessionState.Variables.Add($hashVars)
|
||||
|
||||
#Add functions
|
||||
# Get every private function and add them to the session state
|
||||
$functions = Get-ChildItem function:\ | Where-Object {$_.name -like "*winutil*" -or $_.name -like "*WPF*"}
|
||||
foreach ($function in $functions){
|
||||
$functionDefinition = Get-Content function:\$($function.name)
|
||||
$functionEntry = New-Object System.Management.Automation.Runspaces.SessionStateFunctionEntry -ArgumentList $($function.name), $functionDefinition
|
||||
|
||||
# And add it to the iss object
|
||||
$initialSessionState.Commands.Add($functionEntry)
|
||||
}
|
||||
|
||||
#Create our runspace pool. We are entering three parameters here min thread count, max thread count and host machine of where these runspaces should be made.
|
||||
$sync.runspace = [runspacefactory]::CreateRunspacePool(1,$maxthreads,$InitialSessionState, $Host)
|
||||
# Create the runspace pool
|
||||
$sync.runspace = [runspacefactory]::CreateRunspacePool(
|
||||
1, # Minimum thread count
|
||||
$maxthreads, # Maximum thread count
|
||||
$InitialSessionState, # Initial session state
|
||||
$Host # Machine to create runspaces on
|
||||
)
|
||||
|
||||
#Open a RunspacePool instance.
|
||||
# Open the RunspacePool instance
|
||||
$sync.runspace.Open()
|
||||
|
||||
#region exception classes
|
||||
# Create classes for different exceptions
|
||||
|
||||
class WingetFailedInstall : Exception {
|
||||
[string] $additionalData
|
||||
@ -46,7 +50,6 @@ $sync.runspace.Open()
|
||||
GenericException($Message) : base($Message) {}
|
||||
}
|
||||
|
||||
#endregion exception classes
|
||||
|
||||
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
|
||||
|
||||
@ -61,8 +64,8 @@ $inputXML = Set-WinUtilUITheme -inputXML $inputXML -themeName $ctttheme
|
||||
|
||||
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
|
||||
[xml]$XAML = $inputXML
|
||||
#Read XAML
|
||||
|
||||
# Read the XAML file
|
||||
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
|
||||
try { $sync["Form"] = [Windows.Markup.XamlReader]::Load( $reader ) }
|
||||
catch [System.Management.Automation.MethodInvocationException] {
|
||||
@ -73,7 +76,6 @@ catch [System.Management.Automation.MethodInvocationException] {
|
||||
}
|
||||
}
|
||||
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."
|
||||
}
|
||||
|
||||
@ -116,7 +118,7 @@ $sync.keys | ForEach-Object {
|
||||
# Setup background config
|
||||
#===========================================================================
|
||||
|
||||
#Load information in the background
|
||||
# Load computer information in the background
|
||||
Invoke-WPFRunspace -ScriptBlock {
|
||||
$sync.ConfigLoaded = $False
|
||||
|
||||
@ -126,25 +128,25 @@ Invoke-WPFRunspace -ScriptBlock {
|
||||
} | Out-Null
|
||||
|
||||
#===========================================================================
|
||||
# Shows the form
|
||||
# Setup and Show the Form
|
||||
#===========================================================================
|
||||
|
||||
# Print the logo
|
||||
Invoke-WPFFormVariables
|
||||
|
||||
try{
|
||||
# Check if Chocolatey is installed
|
||||
Install-WinUtilChoco
|
||||
}
|
||||
Catch [ChocoFailedInstall]{
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Chocolatey failed to install ---"
|
||||
Write-Host "==========================================="
|
||||
}
|
||||
|
||||
# Set the titlebar
|
||||
$sync["Form"].title = $sync["Form"].title + " " + $sync.version
|
||||
# Set the commands that will run when the form is closed
|
||||
$sync["Form"].Add_Closing({
|
||||
$sync.runspace.Dispose()
|
||||
$sync.runspace.Close()
|
||||
[System.GC]::Collect()
|
||||
})
|
||||
|
||||
# Show the form
|
||||
$sync["Form"].ShowDialog() | out-null
|
||||
|
||||
Stop-Transcript
|
@ -11,7 +11,7 @@ Start-Transcript $ENV:TEMP\Winutil.log -Append
|
||||
# Load DLLs
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
|
||||
# variable to sync between runspaces
|
||||
# Variable to sync between runspaces
|
||||
$sync = [Hashtable]::Synchronized(@{})
|
||||
$sync.PSScriptRoot = $PSScriptRoot
|
||||
$sync.version = "#{replaceme}"
|
||||
|
29
winget.ps1
29
winget.ps1
@ -1,6 +1,6 @@
|
||||
<#PSScriptInfo
|
||||
|
||||
.VERSION 3.0.0
|
||||
.VERSION 3.0.1
|
||||
|
||||
.GUID 3b581edb-5d90-4fa1-ba15-4f2377275463
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
[Version 2.1.0] - Added alternate method/URL for dependencies in case the main URL is down. Fixed licensing issue when winget is installed on Server 2022.
|
||||
[Version 2.1.1] - Switched primary/alternate methods. Added Cleanup function to avoid errors when cleaning up temp files. Added output of URL for alternate method. Suppressed Add-AppxProvisionedPackage output. Improved success message. Improved verbiage. Improve PS script comments. Added check if the URL is empty. Moved display of URL beneath the check.
|
||||
[Version 3.0.0] - Major changes. Added OS version detection checks - detects OS version, release ID, ensures compatibility. Forces older file installation for Server 2022 to avoid issues after installing. Added DebugMode, DisableCleanup, Force. Renamed CheckForUpdates to CheckForUpdate. Improved output. Improved error handling. Improved comments. Improved code readability. Moved CheckForUpdate into function. Added PowerShellGalleryName. Renamed Get-OSVersion to Get-OSInfo. Moved architecture detection into Get-OSInfo. Renamed Get-NewestLink to Get-WingetDownloadUrl. Have Get-WingetDownloadUrl not get preview releases.
|
||||
[Version 3.0.1] - Updated Get-OSInfo function to fix issues when used on non-English systems. Improved error handling of "resources in use" error.
|
||||
|
||||
#>
|
||||
|
||||
@ -56,7 +57,7 @@ This function should be run with administrative privileges.
|
||||
.PARAMETER Help
|
||||
Displays the full help information for the script.
|
||||
.NOTES
|
||||
Version : 3.0.0
|
||||
Version : 3.0.1
|
||||
Created by : asheroto
|
||||
.LINK
|
||||
Project Site: https://github.com/asheroto/winget-install
|
||||
@ -72,7 +73,7 @@ param (
|
||||
)
|
||||
|
||||
# Version
|
||||
$CurrentVersion = '3.0.0'
|
||||
$CurrentVersion = '3.0.1'
|
||||
$RepoOwner = 'asheroto'
|
||||
$RepoName = 'winget-install'
|
||||
$PowerShellGalleryName = 'winget-install'
|
||||
@ -158,12 +159,13 @@ function Get-OSInfo {
|
||||
$nameValue = $osDetails.Caption
|
||||
|
||||
# Get architecture details of the OS (not the processor)
|
||||
$architecture = $osDetails.OSArchitecture
|
||||
# Get only the numbers
|
||||
$architecture = ($osDetails.OSArchitecture -replace "[^\d]").Trim()
|
||||
|
||||
# If 32-bit or 64-bit replace with x32 and x64
|
||||
if ($architecture -eq "32-bit") {
|
||||
if ($architecture -eq "32") {
|
||||
$architecture = "x32"
|
||||
} elseif ($architecture -eq "64-bit") {
|
||||
} elseif ($architecture -eq "64") {
|
||||
$architecture = "x64"
|
||||
}
|
||||
|
||||
@ -624,12 +626,20 @@ function Install-Prerequisite {
|
||||
throw
|
||||
}
|
||||
|
||||
Write-Output "URL: ${url}"
|
||||
Write-Output "`nInstalling ${arch} ${Name}..."
|
||||
if ($DebugMode) {
|
||||
Write-Output "URL: ${url}`n"
|
||||
}
|
||||
Write-Output "Installing ${arch} ${Name}..."
|
||||
Add-AppxPackage $url -ErrorAction Stop
|
||||
Write-Output "`n$Name installed successfully."
|
||||
} catch {
|
||||
# Alternate method
|
||||
if ($_.Exception.Message -match '0x80073D02') {
|
||||
# If resources in use exception, fail immediately
|
||||
Handle-Error $_
|
||||
throw
|
||||
}
|
||||
|
||||
try {
|
||||
$url = $AlternateUrl
|
||||
|
||||
@ -758,6 +768,7 @@ if ($CheckForUpdate) {
|
||||
|
||||
# Heading
|
||||
Write-Output "winget-install $CurrentVersion"
|
||||
Write-Output "To check for updates, run winget-install -CheckForUpdate"
|
||||
|
||||
# Set OS version
|
||||
$osVersion = Get-OSInfo
|
||||
@ -891,7 +902,7 @@ try {
|
||||
if (Get-WingetStatus -eq $true) {
|
||||
Write-Output "winget is installed and working now, you can go ahead and use it."
|
||||
} else {
|
||||
Write-Warning "winget is installed but is not detected as a command. Try using winget now. If it doesn't work, try restarting your computer."
|
||||
Write-Warning "winget is installed but is not detected as a command. Try using winget now. If it doesn't work, wait about 1 minute and try again (it is sometimes delayed). Also try restarting your computer."
|
||||
Write-Warning "If you restart your computer and the command still isn't recognized, please read the Troubleshooting section`nof the README: https://github.com/asheroto/winget-install#troubleshooting`n"
|
||||
Write-Warning "Make sure you have the latest version of the script by running this command: $PowerShellGalleryName -CheckForUpdate"
|
||||
}
|
||||
|
614
winutil.ps1
614
winutil.ps1
File diff suppressed because it is too large
Load Diff
@ -261,12 +261,14 @@
|
||||
<CheckBox Name="WPFInstalledge" Content="Edge" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallfirefox" Content="Firefox" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstalllibrewolf" Content="LibreWolf" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallthorium" Content="Thorium Browser" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstalltor" Content="Tor Browser" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallvivaldi" Content="Vivaldi" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallwaterfox" Content="Waterfox" Margin="5,0"/>
|
||||
|
||||
<Label Content="Communications" FontSize="16" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstalldiscord" Content="Discord" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallguilded" Content="Guilded" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallhexchat" Content="Hexchat" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstalljami" Content="Jami" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallmatrix" Content="Matrix" Margin="5,0"/>
|
||||
@ -333,6 +335,7 @@
|
||||
<CheckBox Name="WPFInstalldotnet3" Content=".NET Desktop Runtime 3.1" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstalldotnet5" Content=".NET Desktop Runtime 5" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstalldotnet6" Content=".NET Desktop Runtime 6" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstalldotnet7" Content=".NET Desktop Runtime 7" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallnuget" Content="Nuget" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallonedrive" Content="OneDrive" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallpowershell" Content="PowerShell" Margin="5,0"/>
|
||||
@ -345,6 +348,7 @@
|
||||
</StackPanel>
|
||||
<StackPanel Background="{MainBackgroundColor}" SnapsToDevicePixels="True" Grid.Row="1" Grid.Column="3" Margin="10">
|
||||
<Label Content="Multimedia Tools" FontSize="16" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallaimp" Content="AIMP (Music Player)" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallaudacity" Content="Audacity" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallblender" Content="Blender (3D Graphics)" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallcider" Content="Cider (FOSS Music Player)" Margin="5,0"/>
|
||||
@ -380,6 +384,7 @@
|
||||
<CheckBox Name="WPFInstallputty" Content="Putty" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallrustdesk" Content="Rust Remote Desktop (FOSS)" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallsimplewall" Content="SimpleWall" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallventoy" Content="Ventoy" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallwinscp" Content="WinSCP" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallwireshark" Content="WireShark" Margin="5,0"/>
|
||||
</StackPanel>
|
||||
@ -405,6 +410,7 @@
|
||||
<CheckBox Name="WPFInstallkeepass" Content="KeePassXC" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallmalwarebytes" Content="MalwareBytes" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallmonitorian" Content="Monitorian" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallmsiafterburner" Content="MSI Afterburner" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallnanazip" Content="NanaZip" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallnvclean" Content="NVCleanstall" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallopenshell" Content="Open Shell (Start Menu)" Margin="5,0"/>
|
||||
@ -416,6 +422,7 @@
|
||||
<CheckBox Name="WPFInstallsandboxie" Content="Sandboxie Plus" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallshell" Content="Shell (Expanded Context Menu)" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallsdio" Content="Snappy Driver Installer Origin" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallsuperf4" Content="SuperF4" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallteamviewer" Content="TeamViewer" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallttaskbar" Content="Translucent Taskbar" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstalltreesize" Content="TreeSize Free" Margin="5,0"/>
|
||||
@ -425,6 +432,7 @@
|
||||
<CheckBox Name="WPFInstallwiztree" Content="WizTree" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallwinrar" Content="WinRAR" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallxdm" Content="Xtreme Download Manager" Margin="5,0"/>
|
||||
<CheckBox Name="WPFInstallzerotierone" Content="ZeroTier One" Margin="5,0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
@ -485,14 +493,14 @@
|
||||
<Label Content="On" />
|
||||
</StackPanel>
|
||||
<Label Content="Performance Plans" />
|
||||
<Button Name="WPFAddUltPerf" Content="Add Ultimate Performance Profile" HorizontalAlignment = "Left" Margin="5,2" Width="300"/>
|
||||
<Button Name="WPFAddUltPerf" Content="Add and Activate Ultimate Performance Profile" HorizontalAlignment = "Left" Margin="5,2" Width="300"/>
|
||||
<Button Name="WPFRemoveUltPerf" Content="Remove Ultimate Performance Profile" HorizontalAlignment = "Left" Margin="5,2" Width="300"/>
|
||||
<Label Content="Shortcuts" />
|
||||
<Button Name="WPFWinUtilShortcut" Content="Create WinUtil Shortcut" HorizontalAlignment = "Left" Margin="5,0" Padding="20,5" Width="300"/>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Background="{MainBackgroundColor}" SnapsToDevicePixels="True" Grid.Row="1" Grid.Column="1" Margin="10,5">
|
||||
<Label FontSize="16" Content="Misc. Tweaks"/>
|
||||
<Label FontSize="16" Content="Advanced Tweaks - CAUTION"/>
|
||||
<CheckBox Name="WPFMiscTweaksNum" Content="Enable NumLock on Startup" Margin="5,0" ToolTip="This creates a time vortex and sends you back to the past... or it simply turns numlock on at startup"/>
|
||||
<CheckBox Name="WPFMiscTweaksLapNum" Content="Disable Numlock on Startup" Margin="5,0" ToolTip="Disables Numlock... Very useful when you are on a laptop WITHOUT 9-key and this fixes that issue when the numlock is enabled!"/>
|
||||
<CheckBox Name="WPFMiscTweaksExt" Content="Show File Extensions" Margin="5,0"/>
|
||||
@ -500,8 +508,8 @@
|
||||
<CheckBox Name="WPFMiscTweaksUTC" Content="Set Time to UTC (Dual Boot)" Margin="5,0" ToolTip="Essential for computers that are dual booting. Fixes the time sync with Linux Systems."/>
|
||||
<CheckBox Name="WPFMiscTweaksDisableUAC" Content="Disable UAC" Margin="5,0" ToolTip="Disables User Account Control. Only recommended for Expert Users."/>
|
||||
<CheckBox Name="WPFMiscTweaksDisableNotifications" Content="Disable Notification Tray/Calendar" Margin="5,0" ToolTip="Disables all Notifications INCLUDING Calendar"/>
|
||||
<CheckBox Name="WPFEssTweaksDeBloat" Content="Remove ALL MS Store Apps" Margin="5,0" ToolTip="USE WITH CAUTION!!!!! This will remove ALL Microsoft store apps other than the essentials to make winget work. Games installed by MS Store ARE INCLUDED!"/>
|
||||
<CheckBox Name="WPFEssTweaksRemoveEdge" Content="Remove Microsoft Edge" Margin="5,0" ToolTip="Removes MS Edge when it gets reinstalled by updates."/>
|
||||
<CheckBox Name="WPFEssTweaksDeBloat" Content="Remove ALL MS Store Apps - NOT RECOMMENDED" Margin="5,0" ToolTip="USE WITH CAUTION!!!!! This will remove ALL Microsoft store apps other than the essentials to make winget work. Games installed by MS Store ARE INCLUDED!"/>
|
||||
<CheckBox Name="WPFEssTweaksRemoveEdge" Content="Remove Microsoft Edge - NOT RECOMMENDED" Margin="5,0" ToolTip="Removes MS Edge when it gets reinstalled by updates."/>
|
||||
<CheckBox Name="WPFEssTweaksRemoveOnedrive" Content="Remove OneDrive" Margin="5,0" ToolTip="Copies OneDrive files to Default Home Folders and Uninstalls it."/>
|
||||
<CheckBox Name="WPFMiscTweaksRightClickMenu" Content="Set Classic Right-Click Menu " Margin="5,0" ToolTip="Great Windows 11 tweak to bring back good context menus when right clicking things in explorer."/>
|
||||
<CheckBox Name="WPFMiscTweaksDisableMouseAcceleration" Content="Disable Mouse Acceleration" Margin="5,0" ToolTip="Disables Mouse Acceleration."/>
|
||||
|
Loading…
Reference in New Issue
Block a user