mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
1032d3d5aa
* Add Progress bar to some stuff https://learn.microsoft.com/en-us/dotnet/api/system.windows.shell.taskbariteminfo?view=windowsdesktop-8.0 * add function to manage taskbar item changed from manually setting the taskbar overlay, progressvalue and progress state to setting them through a function * add description feature * use Dispatcher.Invoke * restructure, fix, additions * fix merge conflicts * add check to progresses * remove progress from wiget & choco install * fix * polish * fix * Update functions/private/Set-WinUtilTaskbarItem.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix syntax * Update functions/private/Set-WinUtilTaskbarItem.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * rework - add overlay presets - rework image saving & converting - removed popup after uninstalling applications * fix description of function * undo winutil * remove check.png * Update functions/private/Set-WinUtilTaskbarItem.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * Update functions/private/Set-WinUtilTaskbarItem.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * rework assets directory & its usage * fixes - ability to set no overlay added - added relative path to winutildir * hotfix * last fixes * add comment * remove trailing whitespaces THX to Mr.K :) * renamed checkmark & added warning * last fixes remove bitmap remove unneeded "| out-null" * hotfix for new commit --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
205 lines
14 KiB
PowerShell
205 lines
14 KiB
PowerShell
function Invoke-WPFundoall {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Undoes every selected tweak
|
|
|
|
#>
|
|
|
|
if($sync.ProcessRunning){
|
|
$msg = "[Invoke-WPFundoall] Install process is currently running."
|
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
|
return
|
|
}
|
|
|
|
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
|
|
|
if ($tweaks.count -eq 0){
|
|
$msg = "Please check the tweaks you wish to undo."
|
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
|
return
|
|
}
|
|
|
|
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock {
|
|
param($Tweaks, $DebugPreference)
|
|
|
|
$sync.ProcessRunning = $true
|
|
if ($Tweaks.count -eq 1){
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
|
} else {
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
|
}
|
|
$cnt = 0
|
|
|
|
Foreach ($tweak in $tweaks){
|
|
Invoke-WinUtilTweaks $tweak -undo $true
|
|
$cnt += 1
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($cnt/$Tweaks.Count) })
|
|
}
|
|
|
|
$sync.ProcessRunning = $false
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
|
Write-Host "=================================="
|
|
Write-Host "--- Undo Tweaks are Finished ---"
|
|
Write-Host "=================================="
|
|
|
|
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
|
$MessageboxTitle = "Tweaks are Finished "
|
|
$Messageboxbody = ("Done")
|
|
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
|
|
|
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
|
}
|
|
|
|
<#
|
|
|
|
Write-Host "Creating Restore Point in case something bad happens"
|
|
Enable-ComputerRestore -Drive "$env:SystemDrive"
|
|
Checkpoint-Computer -Description "RestorePoint1" -RestorePointType "MODIFY_SETTINGS"
|
|
|
|
Write-Host "Enabling Telemetry..."
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 1
|
|
Write-Host "Enabling Wi-Fi Sense"
|
|
Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 1
|
|
Write-Host "Enabling Application suggestions..."
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "ContentDeliveryAllowed" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "OemPreInstalledAppsEnabled" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEnabled" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEverEnabled" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SilentInstalledAppsEnabled" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338387Enabled" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338388Enabled" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338389Enabled" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353698Enabled" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 1
|
|
If (Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent") {
|
|
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Recurse -ErrorAction SilentlyContinue
|
|
}
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 0
|
|
Write-Host "Enabling Activity History..."
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -Type DWord -Value 1
|
|
Write-Host "Enable Location Tracking..."
|
|
If (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location") {
|
|
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Recurse -ErrorAction SilentlyContinue
|
|
}
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Name "Value" -Type String -Value "Allow"
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 1
|
|
Write-Host "Enabling automatic Maps updates..."
|
|
Set-ItemProperty -Path "HKLM:\SYSTEM\Maps" -Name "AutoUpdateEnabled" -Type DWord -Value 1
|
|
Write-Host "Enabling Feedback..."
|
|
If (Test-Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules") {
|
|
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Recurse -ErrorAction SilentlyContinue
|
|
}
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "DoNotShowFeedbackNotifications" -Type DWord -Value 0
|
|
Write-Host "Enabling Tailored Experiences..."
|
|
If (Test-Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent") {
|
|
Remove-Item -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Recurse -ErrorAction SilentlyContinue
|
|
}
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableTailoredExperiencesWithDiagnosticData" -Type DWord -Value 0
|
|
Write-Host "Disabling Advertising ID..."
|
|
If (Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo") {
|
|
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Recurse -ErrorAction SilentlyContinue
|
|
}
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Name "DisabledByGroupPolicy" -Type DWord -Value 0
|
|
Write-Host "Allow Error reporting..."
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -Type DWord -Value 0
|
|
Write-Host "Allowing Diagnostics Tracking Service..."
|
|
Stop-Service "DiagTrack" -WarningAction SilentlyContinue
|
|
Set-Service "DiagTrack" -StartupType Manual
|
|
Write-Host "Allowing WAP Push Service..."
|
|
Stop-Service "dmwappushservice" -WarningAction SilentlyContinue
|
|
Set-Service "dmwappushservice" -StartupType Manual
|
|
Write-Host "Allowing Home Groups services..."
|
|
Stop-Service "HomeGroupListener" -WarningAction SilentlyContinue
|
|
Set-Service "HomeGroupListener" -StartupType Manual
|
|
Stop-Service "HomeGroupProvider" -WarningAction SilentlyContinue
|
|
Set-Service "HomeGroupProvider" -StartupType Manual
|
|
Write-Host "Enabling Storage Sense..."
|
|
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" | Out-Null
|
|
Write-Host "Allowing Superfetch service..."
|
|
Stop-Service "SysMain" -WarningAction SilentlyContinue
|
|
Set-Service "SysMain" -StartupType Manual
|
|
Write-Host "Setting BIOS time to Local Time instead of UTC..."
|
|
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Type DWord -Value 0
|
|
Write-Host "Enabling Hibernation..."
|
|
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Session Manager\Power" -Name "HibernteEnabled" -Type Dword -Value 1
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" -Name "ShowHibernateOption" -Type Dword -Value 1
|
|
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" -ErrorAction SilentlyContinue
|
|
|
|
Write-Host "Hiding file operations details..."
|
|
If (Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager") {
|
|
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Recurse -ErrorAction SilentlyContinue
|
|
}
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Name "EnthusiastMode" -Type DWord -Value 0
|
|
Write-Host "Showing Task View button..."
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -Type DWord -Value 1
|
|
|
|
Write-Host "Changing default Explorer view to Quick Access..."
|
|
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 0
|
|
|
|
Write-Host "Unrestricting AutoLogger directory"
|
|
$autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger"
|
|
icacls $autoLoggerDir /grant:r SYSTEM:`(OI`)`(CI`)F | Out-Null
|
|
|
|
Write-Host "Enabling and starting Diagnostics Tracking Service"
|
|
Set-Service "DiagTrack" -StartupType Automatic
|
|
Start-Service "DiagTrack"
|
|
|
|
Write-Host "Hiding known file extensions"
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1
|
|
|
|
Write-Host "Reset Local Group Policies to Stock Defaults"
|
|
# cmd /c secedit /configure /cfg %windir%\inf\defltbase.inf /db defltbase.sdb /verbose
|
|
cmd /c RD /S /Q "%WinDir%\System32\GroupPolicyUsers"
|
|
cmd /c RD /S /Q "%WinDir%\System32\GroupPolicy"
|
|
cmd /c gpupdate /force
|
|
# Considered using Invoke-GPUpdate but requires module most people won't have installed
|
|
|
|
Write-Host "Adjusting visual effects for appearance..."
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Type String -Value 1
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type String -Value 400
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Type Binary -Value ([byte[]](158, 30, 7, 128, 18, 0, 0, 0))
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Type String -Value 1
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\Keyboard" -Name "KeyboardDelay" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewAlphaSelect" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewShadow" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Type DWord -Value 1
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Type DWord -Value 3
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "EnableAeroPeek" -Type DWord -Value 1
|
|
Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -ErrorAction SilentlyContinue
|
|
Write-Host "Restoring Clipboard History..."
|
|
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Clipboard" -Name "EnableClipboardHistory" -ErrorAction SilentlyContinue
|
|
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "AllowClipboardHistory" -ErrorAction SilentlyContinue
|
|
Write-Host "Enabling Notifications and Action Center"
|
|
Remove-Item -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Force
|
|
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled"
|
|
Write-Host "Restoring Default Right Click Menu Layout"
|
|
Remove-Item -Path "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" -Recurse -Confirm:$false -Force
|
|
|
|
Write-Host "Reset News and Interests"
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name "EnableFeeds" -Type DWord -Value 1
|
|
# Remove "News and Interest" from taskbar
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Feeds" -Name "ShellFeedsTaskbarViewMode" -Type DWord -Value 0
|
|
Write-Host "Done - Reverted to Stock Settings"
|
|
|
|
Write-Host "Essential Undo Completed"
|
|
|
|
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
|
$MessageboxTitle = "Undo All"
|
|
$Messageboxbody = ("Done")
|
|
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
|
|
|
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
|
|
|
Write-Host "================================="
|
|
Write-Host "--- Undo All is Finished ---"
|
|
Write-Host "================================="
|
|
#>
|
|
} |