From 7dcdc4dbb7c35bc2915d1899f17838c42ffbae1f Mon Sep 17 00:00:00 2001 From: ChrisTitusTech Date: Sat, 26 Oct 2024 15:31:46 +0000 Subject: [PATCH 1/7] =?UTF-8?q?Deploying=20to=20main=20from=20@=20ChrisTit?= =?UTF-8?q?usTech/winutil@bfaba1419101d90fd6354e45c4c81180eb1f65a5=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 112794b5..d2442513 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win These are the sponsors that help keep this project alive with monthly contributions. -Yusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattRMSStefanPaulDave JonesAnthony MendezxPandakuClaudemodsTimothy CookMaxDursleyGuySandman616 +Yusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattRMSStefanPaulDave JonesAnthony MendezxPandakuClaudemodsMaxDursleyGuySandman616Phillip Waters ## 🏅 Thanks to all Contributors Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻. From 1caf3111d3ef31cace0a1384071000e0a54c3a5e Mon Sep 17 00:00:00 2001 From: Chris Titus Tech Date: Tue, 29 Oct 2024 16:21:57 -0500 Subject: [PATCH 2/7] remove shortcut hexedit --- functions/public/Invoke-WPFShortcut.ps1 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/functions/public/Invoke-WPFShortcut.ps1 b/functions/public/Invoke-WPFShortcut.ps1 index e4e47871..9f5d379f 100644 --- a/functions/public/Invoke-WPFShortcut.ps1 +++ b/functions/public/Invoke-WPFShortcut.ps1 @@ -61,12 +61,5 @@ function Invoke-WPFShortcut { # Save the Shortcut to disk $Shortcut.Save() - if ($RunAsAdmin -eq $true) { - $bytes = [System.IO.File]::ReadAllBytes($FileBrowser.FileName) - # Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex - $bytes[0x15] = $bytes[0x15] -bor 0x20 - [System.IO.File]::WriteAllBytes($FileBrowser.FileName, $bytes) - } - Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName) with 'Run as administrator' set to $RunAsAdmin" } From c186642998a77bcb95e59c46dd272f100ab50423 Mon Sep 17 00:00:00 2001 From: Chris Titus Tech Date: Tue, 29 Oct 2024 16:35:43 -0500 Subject: [PATCH 3/7] Remove WPFShortcut Creation Was causing virus false positives. --- config/tweaks.json | 9 -- .../tweaks/Essential-Tweaks/DisableRecall.md | 6 +- docs/dev/tweaks/Shortcuts/Shortcut.md | 84 ------------------- functions/public/Invoke-WPFButton.ps1 | 1 - functions/public/Invoke-WPFShortcut.ps1 | 65 -------------- 5 files changed, 3 insertions(+), 162 deletions(-) delete mode 100644 functions/public/Invoke-WPFShortcut.ps1 diff --git a/config/tweaks.json b/config/tweaks.json index 2a6bf95e..93ed630c 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3464,14 +3464,5 @@ "Type": "Button", "ButtonWidth": "300", "link": "https://christitustech.github.io/winutil/dev/tweaks/Performance-Plans/RemoveUltPerf" - }, - "WPFWinUtilShortcut": { - "Content": "Create WinUtil Shortcut", - "category": "Shortcuts", - "panel": "2", - "Order": "a082_", - "Type": "Button", - "ButtonWidth": "300", - "link": "https://christitustech.github.io/winutil/dev/tweaks/Shortcuts/Shortcut" } } diff --git a/docs/dev/tweaks/Essential-Tweaks/DisableRecall.md b/docs/dev/tweaks/Essential-Tweaks/DisableRecall.md index 6635a7dc..a6ceaa73 100644 --- a/docs/dev/tweaks/Essential-Tweaks/DisableRecall.md +++ b/docs/dev/tweaks/Essential-Tweaks/DisableRecall.md @@ -36,7 +36,7 @@ Disables MS Recall built into Windows since 24H2. "InvokeScript": [ " Write-Host \"Disable Recall\" - DISM /Online /Disable-Feature /FeatureName:Recall + DISM /Online /Disable-Feature /FeatureName:Recall " ], "UndoScript": [ @@ -45,7 +45,7 @@ Disables MS Recall built into Windows since 24H2. DISM /Online /Enable-Feature /FeatureName:Recall " ], - "link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DisableRecall" + "link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DisableRecall" }, ``` @@ -56,7 +56,7 @@ Disables MS Recall built into Windows since 24H2. ```powershell Write-Host "Disable Recall" - DISM /Online /Disable-Feature /FeatureName:Recall + DISM /Online /Disable-Feature /FeatureName:Recall ``` diff --git a/docs/dev/tweaks/Shortcuts/Shortcut.md b/docs/dev/tweaks/Shortcuts/Shortcut.md index c980269e..e1776a30 100644 --- a/docs/dev/tweaks/Shortcuts/Shortcut.md +++ b/docs/dev/tweaks/Shortcuts/Shortcut.md @@ -27,87 +27,3 @@ Last Updated: 2024-08-07 ``` - -## Function: Invoke-WPFShortcut - -```powershell -function Invoke-WPFShortcut { - <# - - .SYNOPSIS - Creates a shortcut and prompts for a save location - - .PARAMETER ShortcutToAdd - The name of the shortcut to add - - .PARAMETER RunAsAdmin - A boolean value to make 'Run as administrator' property on (true) or off (false), defaults to off - - #> - param( - $ShortcutToAdd, - [bool]$RunAsAdmin = $false - ) - - # Preper the Shortcut Fields and add an a Custom Icon if it's available, else don't add a Custom Icon. - - Switch ($ShortcutToAdd) { - "WinUtil" { - # Use Powershell 7 if installed and fallback to PS5 if not - if (Get-Command "pwsh" -ErrorAction SilentlyContinue) { - $shell = "pwsh.exe" - } else { - $shell = "powershell.exe" - } - - $shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex`"`'" - - $DestinationName = "WinUtil.lnk" - } - } - - # Show a File Dialog Browser, to let the User choose the Name and Location of where to save the Shortcut - $FileBrowser = New-Object System.Windows.Forms.SaveFileDialog - $FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop') - $FileBrowser.Filter = "Shortcut Files (*.lnk)|*.lnk" - $FileBrowser.FileName = $DestinationName - - # Do an Early Return if the Save Operation was canceled by User's Input. - $FileBrowserResult = $FileBrowser.ShowDialog() - $DialogResultEnum = New-Object System.Windows.Forms.DialogResult - if (-not ($FileBrowserResult -eq $DialogResultEnum::OK)) { - return - } - - # Prepare the Shortcut paramter - $WshShell = New-Object -comObject WScript.Shell - $Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName) - $Shortcut.TargetPath = $shell - $Shortcut.Arguments = $shellArgs - if (Test-Path -Path $winutildir["logo.ico"]) { - $shortcut.IconLocation = $winutildir["logo.ico"] - } - - # Save the Shortcut to disk - $Shortcut.Save() - - if ($RunAsAdmin -eq $true) { - $bytes = [System.IO.File]::ReadAllBytes($FileBrowser.FileName) - # Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex - $bytes[0x15] = $bytes[0x15] -bor 0x20 - [System.IO.File]::WriteAllBytes($FileBrowser.FileName, $bytes) - } - - Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName) with 'Run as administrator' set to $RunAsAdmin" -} - -``` - - - - - - - -[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/tweaks.json) - diff --git a/functions/public/Invoke-WPFButton.ps1 b/functions/public/Invoke-WPFButton.ps1 index ee4d0421..6473f693 100644 --- a/functions/public/Invoke-WPFButton.ps1 +++ b/functions/public/Invoke-WPFButton.ps1 @@ -50,7 +50,6 @@ function Invoke-WPFButton { "WPFFixesNetwork" {Invoke-WPFFixesNetwork} "WPFUpdatesdisable" {Invoke-WPFUpdatesdisable} "WPFUpdatessecurity" {Invoke-WPFUpdatessecurity} - "WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil" -RunAsAdmin $true} "WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"} "WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"} "WPFGetIso" {Invoke-WPFGetIso} diff --git a/functions/public/Invoke-WPFShortcut.ps1 b/functions/public/Invoke-WPFShortcut.ps1 deleted file mode 100644 index 9f5d379f..00000000 --- a/functions/public/Invoke-WPFShortcut.ps1 +++ /dev/null @@ -1,65 +0,0 @@ -function Invoke-WPFShortcut { - <# - - .SYNOPSIS - Creates a shortcut and prompts for a save location - - .PARAMETER ShortcutToAdd - The name of the shortcut to add - - .PARAMETER RunAsAdmin - A boolean value to make 'Run as administrator' property on (true) or off (false), defaults to off - - #> - param( - $ShortcutToAdd, - [bool]$RunAsAdmin = $false - ) - - # Preper the Shortcut Fields and add an a Custom Icon if it's available, else don't add a Custom Icon. - - Switch ($ShortcutToAdd) { - "WinUtil" { - # Use Powershell 7 if installed and fallback to PS5 if not - if (Get-Command "pwsh" -ErrorAction SilentlyContinue) { - $shell = "pwsh.exe" - } else { - $shell = "powershell.exe" - } - - $shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex`"`'" - - $DestinationName = "WinUtil.lnk" - } - } - - # Show a File Dialog Browser, to let the User choose the Name and Location of where to save the Shortcut - $FileBrowser = New-Object System.Windows.Forms.SaveFileDialog - $FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop') - $FileBrowser.Filter = "Shortcut Files (*.lnk)|*.lnk" - $FileBrowser.FileName = $DestinationName - - # Do an Early Return if the Save Operation was canceled by User's Input. - $FileBrowserResult = $FileBrowser.ShowDialog() - $DialogResultEnum = New-Object System.Windows.Forms.DialogResult - if (-not ($FileBrowserResult -eq $DialogResultEnum::OK)) { - return - } - - # Prepare the Shortcut paramter - $WshShell = New-Object -comObject WScript.Shell - $Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName) - $Shortcut.TargetPath = $shell - $Shortcut.Arguments = $shellArgs - if (-NOT (Test-Path -Path $winutildir["logo.ico"])) { - Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.ico" -OutFile $winutildir["logo.ico"] - } - if (Test-Path -Path $winutildir["logo.ico"]) { - $shortcut.IconLocation = $winutildir["logo.ico"] - } - - # Save the Shortcut to disk - $Shortcut.Save() - - Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName) with 'Run as administrator' set to $RunAsAdmin" -} From 640d2ca1074acecba968929fb00e8f8b49b9589e Mon Sep 17 00:00:00 2001 From: CodingWonders <101426328+CodingWonders@users.noreply.github.com> Date: Tue, 29 Oct 2024 22:51:32 +0100 Subject: [PATCH 4/7] [MicroWin] Remove WinUtil shortcut on first logon (#2989) --- .../private/Invoke-WinUtilMicroWin-Helper.ps1 | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 index c1ca7ad0..361f21b2 100644 --- a/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 +++ b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1 @@ -807,41 +807,6 @@ function New-FirstRun { Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk" Remove-Item -Path "$env:HOMEDRIVE\Users\Default\Desktop\*.lnk" - # ************************************************ - # Create WinUtil shortcut on the desktop - # - $desktopPath = "$($env:USERPROFILE)\Desktop" - # Specify the target PowerShell command - $command = "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'irm https://christitus.com/win | iex'" - # Specify the path for the shortcut - $shortcutPath = Join-Path $desktopPath 'winutil.lnk' - # Create a shell object - $shell = New-Object -ComObject WScript.Shell - - # Create a shortcut object - $shortcut = $shell.CreateShortcut($shortcutPath) - - if (Test-Path -Path "$env:HOMEDRIVE\Windows\cttlogo.png") { - $shortcut.IconLocation = "$env:HOMEDRIVE\Windows\cttlogo.png" - } - - # Set properties of the shortcut - $shortcut.TargetPath = "powershell.exe" - $shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`"" - # Save the shortcut - $shortcut.Save() - - # Make the shortcut have 'Run as administrator' property on - $bytes = [System.IO.File]::ReadAllBytes($shortcutPath) - # Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex - $bytes[0x15] = $bytes[0x15] -bor 0x20 - [System.IO.File]::WriteAllBytes($shortcutPath, $bytes) - - Write-Host "Shortcut created at: $shortcutPath" - # - # Done create WinUtil shortcut on the desktop - # ************************************************ - try { if ((Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -like "Recall" }).Count -gt 0) From c254a43f7790c60e7db3a93a2abc9db1499c9a90 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Tue, 29 Oct 2024 16:58:14 -0500 Subject: [PATCH 5/7] Fix policy reset for default updates --- functions/public/Invoke-WPFUpdatesdefault.ps1 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/functions/public/Invoke-WPFUpdatesdefault.ps1 b/functions/public/Invoke-WPFUpdatesdefault.ps1 index 0b786f32..0b8403c6 100644 --- a/functions/public/Invoke-WPFUpdatesdefault.ps1 +++ b/functions/public/Invoke-WPFUpdatesdefault.ps1 @@ -42,4 +42,24 @@ function Invoke-WPFUpdatesdefault { Write-Host "===================================================" Write-Host "--- Windows Update Settings Reset to Default ---" Write-Host "===================================================" + + Start-Process -FilePath "secedit" -ArgumentList "/configure /cfg $env:windir\inf\defltbase.inf /db defltbase.sdb /verbose" -Wait + Start-Process -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicyUsers" -Wait + Start-Process -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicy" -Wait + Start-Process -FilePath "gpupdate" -ArgumentList "/force" -Wait + Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKCU:\Software\Microsoft\WindowsSelfHost" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKCU:\Software\Policies" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKLM:\Software\Microsoft\Policies" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKLM:\Software\Microsoft\WindowsSelfHost" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKLM:\Software\Policies" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Policies" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue + + Write-Host "===================================================" + Write-Host "--- Windows Local Policies Reset to Default ---" + Write-Host "===================================================" } From 77cb0a14c4dcbb3cad3d2e60270654be9f1edcaf Mon Sep 17 00:00:00 2001 From: Real-MullaC Date: Tue, 29 Oct 2024 22:27:31 +0000 Subject: [PATCH 6/7] Gets docs ready for moving (#2992) --- docs/dev/tweaks/Shortcuts/Shortcut.md | 29 --------------------------- overrides/main.html | 1 + 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 docs/dev/tweaks/Shortcuts/Shortcut.md diff --git a/docs/dev/tweaks/Shortcuts/Shortcut.md b/docs/dev/tweaks/Shortcuts/Shortcut.md deleted file mode 100644 index e1776a30..00000000 --- a/docs/dev/tweaks/Shortcuts/Shortcut.md +++ /dev/null @@ -1,29 +0,0 @@ -# Create WinUtil Shortcut - -Last Updated: 2024-08-07 - - -!!! info - The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.** - - - - - - -
-Preview Code - -```json -{ - "Content": "Create WinUtil Shortcut", - "category": "Shortcuts", - "panel": "2", - "Order": "a082_", - "Type": "Button", - "ButtonWidth": "300", - "link": "https://christitustech.github.io/winutil/dev/tweaks/Shortcuts/Shortcut" -} -``` - -
diff --git a/overrides/main.html b/overrides/main.html index bf27a2c6..c8d5a413 100644 --- a/overrides/main.html +++ b/overrides/main.html @@ -4,6 +4,7 @@ {{ super() }}
Announcement: We are currently not adding any applications to WinUtil and any apps that will be added through a PR will be declined by the maintainer. + Announcement: We are currently reworking the docs to use Hugo rather then mkdocs.
{% endblock %} From ce1ef2a5194041224c28a44557153eb3a483f00e Mon Sep 17 00:00:00 2001 From: ChrisTitusTech Date: Fri, 1 Nov 2024 15:33:13 +0000 Subject: [PATCH 7/7] =?UTF-8?q?Deploying=20to=20main=20from=20@=20ChrisTit?= =?UTF-8?q?usTech/winutil@77cb0a14c4dcbb3cad3d2e60270654be9f1edcaf=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d2442513..b3ef0aa9 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win These are the sponsors that help keep this project alive with monthly contributions. -Yusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattRMSStefanPaulDave JonesAnthony MendezxPandakuClaudemodsMaxDursleyGuySandman616Phillip Waters +Yusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattRMSStefanPaulDave JonesAnthony MendezxPandakuClaudemodsMaxDursleyGuySandman616Phillip Waters ## 🏅 Thanks to all Contributors Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.