mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-05 20:44:55 -06:00
Compare commits
No commits in common. "77cb0a14c4dcbb3cad3d2e60270654be9f1edcaf" and "7dcdc4dbb7c35bc2915d1899f17838c42ffbae1f" have entirely different histories.
77cb0a14c4
...
7dcdc4dbb7
@ -3464,5 +3464,14 @@
|
|||||||
"Type": "Button",
|
"Type": "Button",
|
||||||
"ButtonWidth": "300",
|
"ButtonWidth": "300",
|
||||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Performance-Plans/RemoveUltPerf"
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ Disables MS Recall built into Windows since 24H2.
|
|||||||
"InvokeScript": [
|
"InvokeScript": [
|
||||||
"
|
"
|
||||||
Write-Host \"Disable Recall\"
|
Write-Host \"Disable Recall\"
|
||||||
DISM /Online /Disable-Feature /FeatureName:Recall
|
DISM /Online /Disable-Feature /FeatureName:Recall
|
||||||
"
|
"
|
||||||
],
|
],
|
||||||
"UndoScript": [
|
"UndoScript": [
|
||||||
@ -45,7 +45,7 @@ Disables MS Recall built into Windows since 24H2.
|
|||||||
DISM /Online /Enable-Feature /FeatureName:Recall
|
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
|
```powershell
|
||||||
|
|
||||||
Write-Host "Disable Recall"
|
Write-Host "Disable Recall"
|
||||||
DISM /Online /Disable-Feature /FeatureName:Recall
|
DISM /Online /Disable-Feature /FeatureName:Recall
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
113
docs/dev/tweaks/Shortcuts/Shortcut.md
Normal file
113
docs/dev/tweaks/Shortcuts/Shortcut.md
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
# 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.**
|
||||||
|
|
||||||
|
|
||||||
|
<!-- BEGIN CUSTOM CONTENT -->
|
||||||
|
|
||||||
|
<!-- END CUSTOM CONTENT -->
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Preview Code</summary>
|
||||||
|
|
||||||
|
```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"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 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"
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
<!-- BEGIN SECOND CUSTOM CONTENT -->
|
||||||
|
|
||||||
|
<!-- END SECOND CUSTOM CONTENT -->
|
||||||
|
|
||||||
|
|
||||||
|
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/tweaks.json)
|
||||||
|
|
@ -807,6 +807,41 @@ function New-FirstRun {
|
|||||||
Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk"
|
Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk"
|
||||||
Remove-Item -Path "$env:HOMEDRIVE\Users\Default\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
|
try
|
||||||
{
|
{
|
||||||
if ((Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -like "Recall" }).Count -gt 0)
|
if ((Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -like "Recall" }).Count -gt 0)
|
||||||
|
@ -50,6 +50,7 @@ function Invoke-WPFButton {
|
|||||||
"WPFFixesNetwork" {Invoke-WPFFixesNetwork}
|
"WPFFixesNetwork" {Invoke-WPFFixesNetwork}
|
||||||
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
|
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
|
||||||
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}
|
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}
|
||||||
|
"WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil" -RunAsAdmin $true}
|
||||||
"WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"}
|
"WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"}
|
||||||
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
|
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
|
||||||
"WPFGetIso" {Invoke-WPFGetIso}
|
"WPFGetIso" {Invoke-WPFGetIso}
|
||||||
|
72
functions/public/Invoke-WPFShortcut.ps1
Normal file
72
functions/public/Invoke-WPFShortcut.ps1
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
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()
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
@ -42,24 +42,4 @@ function Invoke-WPFUpdatesdefault {
|
|||||||
Write-Host "==================================================="
|
Write-Host "==================================================="
|
||||||
Write-Host "--- Windows Update Settings Reset to Default ---"
|
Write-Host "--- Windows Update Settings Reset to Default ---"
|
||||||
Write-Host "==================================================="
|
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 "==================================================="
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
{{ super() }}
|
{{ super() }}
|
||||||
<div style="color: red; text-align: center; padding: 10px; font-size: 20px;">
|
<div style="color: red; text-align: center; padding: 10px; font-size: 20px;">
|
||||||
<strong>Announcement:</strong> 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.
|
<strong>Announcement:</strong> 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.
|
||||||
<strong>Announcement:</strong> We are currently reworking the docs to use Hugo rather then mkdocs.
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user