mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 06:35:51 -06:00
Test (#94)
* xml decouple
* Typos: Documents, Start installs (#18)
Document -> Documents
Start install -> Start installs
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* Added DISM command and button to tool (#19)
* Added DISM command and button to tool
* Added additional scans and colours to make it clear when each scan type starts
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* Fix issue in #14 (#20)
* Fix issue in #14
- It seems that Chris forgot to add a button for the Repair Windows Update Script and accidentally put it under the Default Windows Update Settings button.
- Fixed by adding the $WPFFixesUpdate.Add_Click function before the Reset Script
- Fixes #14
* decoupling xaml and ps1 (#7)
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
Co-authored-by: Rahul Somasundaram <rahulstsgr@gmail.com>
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* Add winget check and installer (#21)
* Add winget check and installer
- Adds Check if winget is installed
- If not installed, checks if the computer is running 1809+ and if the computer is running Windows Server or LTSC
- If running pre-1809, winget install stops as it is not supported
- If running Windows Server or Windows LTSC, runs alternative installer compatible with those editions of Windows
* decoupling xaml and ps1 (#7)
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
Co-authored-by: Rahul Somasundaram <rahulstsgr@gmail.com>
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* Small Fixes. (#22)
* Update winutil.ps1
* Use Curl instead of Bits transfer for O&O Shutup.
* Update winutil.ps1
* decoupling xaml and ps1 (#7)
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
Co-authored-by: Rahul Somasundaram <rahulstsgr@gmail.com>
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* upload example (#12)
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* code format using powershell VS code extension (#28)
* Working runspaces (#32)
* upload example
* decoupling xaml and ps1 (#7)
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* Update README.md
* convert to runspaces
* add security updates to invoke-button
* Update README.md
removed extra text about test branch
* initial commit to test restmethod
* formatting
Co-authored-by: Rahul Somasundaram <rahulstsgr@gmail.com>
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* Fix bug in #39 (#40)
- Closes #39
- $arch is not set to a value in the script, and it throws an error when the If-Statement is called
- Fixed by replacing the $arch variable check with a wmic check
* Fix and Tweak #19 (#43)
* Fix Issue in #19
- Pull Request #19 didn't add an entry for PanelDISM into MainWindow.xaml, causing an error to be thrown when the script if executed and a button to not be created
- Fixed by adding an entry into MainWIndow.xaml that creates the needed button under the FixesUpdate button
- Note: To see the fix, you need to comment line 9 and uncomment line 8 to use the local MainWindow.xaml instead of the one in the Main Branch
* Fix Formatting and Tweak Things
- Fixed the formatting
- Tweaked Write-Host's
- Added newlines (`n) to space out the Statuses
- Added progress indicators
- Required "s and 's to be swapped so x/4 does not perform an operation
* Slight Tweak
* Added Uncheck all button in the Install tab (#29)
* Revert "Added Uncheck all button in the Install tab (#29)" (#72)
This reverts commit 833837155a
.
* Throw warning if no programs are selected for installation (#30)
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* Fix a few spelling errors (#44)
- Fixed a few spelling errors
- dependancies -> dependencies
- Evnronment -> Environment
- haved -> have
- Hibernte -> Hibernate
- histroy -> history
- extentions -> extensions
* Arguments (#52)
* Implement Arguments
- Using $env:args, the script scans for arguments; then if found, Invokes the Runspace associated with said arg. Or in the case of the old panels, just opens the panel.
- \b is to prevent mutual words from causing issues (Ex: Install and InstallUpgrade would conflict without \b)
* Actually add \b
Forgot to save before previous commit : |
* Fix Order Issue
- The arg check occurred too early, causing an error
* Remove Invoke-Runspace
- Replaced Invoke-Runspace with Invoke-Command as there is no need to worry about the gui when running unattended
* Add Program Install Arg Check
- Added arg check for Install
- Format is 'Install: company.program,.company.program2'
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* Replace all instances of "incase" to "in case" (#60)
Co-authored-by: Chris Titus <dfm.titus@gmail.com>
* Added -NoRestart to WindowsOptionalFeature (#65)
* Handled UAC exit on install and upgrade (#31)
Co-authored-by: ChrisTitusTech <dfm.titus@gmail.com>
Co-authored-by: Ayoub Hebbaj <30575106+M3nti0nL3Ss@users.noreply.github.com>
Co-authored-by: Jards <jordancattwood@hotmail.com>
Co-authored-by: Carter <60557606+Carterpersall@users.noreply.github.com>
Co-authored-by: Rahul Somasundaram <rahulstsgr@gmail.com>
Co-authored-by: Aetopia <41850963+Aetopia@users.noreply.github.com>
Co-authored-by: DeveloperDurp <74198206+DeveloperDurp@users.noreply.github.com>
Co-authored-by: Rahul Somasundaram <ssrahul96@gmail.com>
Co-authored-by: GrahamboJangles <36944031+GrahamboJangles@users.noreply.github.com>
Co-authored-by: PWall <34860495+pwall2222@users.noreply.github.com>
This commit is contained in:
parent
bf1d455f80
commit
fecc54d71d
@ -197,6 +197,7 @@
|
||||
<Button Name="FeatureInstall" FontSize="14" Background="AliceBlue" Content="Install Features" Margin="20,5,20,0" Padding="10"/>
|
||||
<Label Content="Fixes" FontSize="16"/>
|
||||
<Button Name="FixesUpdate" FontSize="14" Background="AliceBlue" Content="Reset Windows Update" Margin="20,5,20,0" Padding="10"/>
|
||||
<Button Name="PanelDISM" FontSize="14" Background="AliceBlue" Content="System Corruption Scan" Margin="20,5,20,0" Padding="10"/>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Background="#777777" SnapsToDevicePixels="True" Grid.Column="1" Margin="10,5">
|
||||
|
229
applications.json
Normal file
229
applications.json
Normal file
@ -0,0 +1,229 @@
|
||||
{
|
||||
"install": {
|
||||
"Installadobe": {
|
||||
"winget": "Adobe.Acrobat.Reader.64-bit"
|
||||
},
|
||||
"Installadvancedip": {
|
||||
"winget": "Famatech.AdvancedIPScanner"
|
||||
},
|
||||
"Installanydesk": {
|
||||
"winget": "AnyDeskSoftwareGmbH.AnyDesk"
|
||||
},
|
||||
"Installatom": {
|
||||
"winget": "GitHub.Atom"
|
||||
},
|
||||
"Installaudacity": {
|
||||
"winget": "Audacity.Audacity"
|
||||
},
|
||||
"Installautohotkey": {
|
||||
"winget": "Lexikos.AutoHotkey"
|
||||
},
|
||||
"Installbitwarden": {
|
||||
"winget": "Bitwarden.Bitwarden"
|
||||
},
|
||||
"Installblender": {
|
||||
"winget": "BlenderFoundation.Blender"
|
||||
},
|
||||
"Installbrave": {
|
||||
"winget": "BraveSoftware.BraveBrowser"
|
||||
},
|
||||
"Installchrome": {
|
||||
"winget": "Google.Chrome"
|
||||
},
|
||||
"Installchromium": {
|
||||
"winget": "eloston.ungoogled-chromium"
|
||||
},
|
||||
"Installcpuz": {
|
||||
"winget": "CPUID.CPU-Z"
|
||||
},
|
||||
"Installdiscord": {
|
||||
"winget": "Discord.Discord"
|
||||
},
|
||||
"Installeartrumpet": {
|
||||
"winget": "File-New-Project.EarTrumpet"
|
||||
},
|
||||
"Installepicgames": {
|
||||
"winget": "EpicGames.EpicGamesLauncher"
|
||||
},
|
||||
"Installesearch": {
|
||||
"winget": "voidtools.Everything --source winget"
|
||||
},
|
||||
"Installetcher": {
|
||||
"winget": "Balena.Etcher"
|
||||
},
|
||||
"Installfirefox": {
|
||||
"winget": "Mozilla.Firefox"
|
||||
},
|
||||
"Installflameshot": {
|
||||
"winget": "Flameshot.Flameshot"
|
||||
},
|
||||
"Installfoobar": {
|
||||
"winget": "PeterPawlowski.foobar2000"
|
||||
},
|
||||
"Installgimp": {
|
||||
"winget": "GIMP.GIMP"
|
||||
},
|
||||
"Installgithubdesktop": {
|
||||
"winget": "Git.Git;GitHub.GitHubDesktop"
|
||||
},
|
||||
"Installgog": {
|
||||
"winget": "GOG.Galaxy"
|
||||
},
|
||||
"Installgpuz": {
|
||||
"winget": "TechPowerUp.GPU-Z"
|
||||
},
|
||||
"Installgreenshot": {
|
||||
"winget": "Greenshot.Greenshot"
|
||||
},
|
||||
"Installhandbrake": {
|
||||
"winget": "HandBrake.HandBrake"
|
||||
},
|
||||
"Installhexchat": {
|
||||
"winget": "HexChat.HexChat"
|
||||
},
|
||||
"Installhwinfo": {
|
||||
"winget": "REALiX.HWiNFO"
|
||||
},
|
||||
"Installimageglass": {
|
||||
"winget": "DuongDieuPhap.ImageGlass"
|
||||
},
|
||||
"Installinkscape": {
|
||||
"winget": "Inkscape.Inkscape"
|
||||
},
|
||||
"Installjava16": {
|
||||
"winget": "AdoptOpenJDK.OpenJDK.16"
|
||||
},
|
||||
"Installjava18": {
|
||||
"winget": "Oracle.JDK.18"
|
||||
},
|
||||
"Installjava8": {
|
||||
"winget": "AdoptOpenJDK.OpenJDK.8"
|
||||
},
|
||||
"Installjetbrains": {
|
||||
"winget": "JetBrains.Toolbox"
|
||||
},
|
||||
"Installkeepass": {
|
||||
"winget": "KeePassXCTeam.KeePassXC"
|
||||
},
|
||||
"Installlibrewolf": {
|
||||
"winget": "LibreWolf.LibreWolf"
|
||||
},
|
||||
"Installmalwarebytes": {
|
||||
"winget": "Malwarebytes.Malwarebytes"
|
||||
},
|
||||
"Installmatrix": {
|
||||
"winget": "Element.Element"
|
||||
},
|
||||
"Installmpc": {
|
||||
"winget": "clsid2.mpc-hc"
|
||||
},
|
||||
"Installmremoteng": {
|
||||
"winget": "mRemoteNG.mRemoteNG"
|
||||
},
|
||||
"Installnodejs": {
|
||||
"winget": "OpenJS.NodeJS"
|
||||
},
|
||||
"Installnodejslts": {
|
||||
"winget": "OpenJS.NodeJS.LTS"
|
||||
},
|
||||
"Installnotepadplus": {
|
||||
"winget": "Notepad++.Notepad++"
|
||||
},
|
||||
"Installnvclean": {
|
||||
"winget": "TechPowerUp.NVCleanstall"
|
||||
},
|
||||
"Installobs": {
|
||||
"winget": "OBSProject.OBSStudio"
|
||||
},
|
||||
"Installobsidian": {
|
||||
"winget": "Obsidian.Obsidian"
|
||||
},
|
||||
"Installpowertoys": {
|
||||
"winget": "Microsoft.PowerToys"
|
||||
},
|
||||
"Installputty": {
|
||||
"winget": "PuTTY.PuTTY"
|
||||
},
|
||||
"Installpython3": {
|
||||
"winget": "Python.Python.3"
|
||||
},
|
||||
"Installrevo": {
|
||||
"winget": "RevoUninstaller.RevoUninstaller"
|
||||
},
|
||||
"Installrufus": {
|
||||
"winget": "Rufus.Rufus"
|
||||
},
|
||||
"Installsevenzip": {
|
||||
"winget": "7zip.7zip"
|
||||
},
|
||||
"Installsharex": {
|
||||
"winget": "ShareX.ShareX"
|
||||
},
|
||||
"Installsignal": {
|
||||
"winget": "OpenWhisperSystems.Signal"
|
||||
},
|
||||
"Installskype": {
|
||||
"winget": "Microsoft.Skype"
|
||||
},
|
||||
"Installslack": {
|
||||
"winget": "SlackTechnologies.Slack"
|
||||
},
|
||||
"Installspotify": {
|
||||
"winget": "Spotify.Spotify"
|
||||
},
|
||||
"Installsteam": {
|
||||
"winget": "Valve.Steam"
|
||||
},
|
||||
"Installsublime": {
|
||||
"winget": "SublimeHQ.SublimeText.4"
|
||||
},
|
||||
"Installsumatra": {
|
||||
"winget": "SumatraPDF.SumatraPDF"
|
||||
},
|
||||
"Installteams": {
|
||||
"winget": "Microsoft.Teams"
|
||||
},
|
||||
"Installteamviewer": {
|
||||
"winget": "TeamViewer.TeamViewer"
|
||||
},
|
||||
"Installterminal": {
|
||||
"winget": "Microsoft.WindowsTerminal"
|
||||
},
|
||||
"Installtreesize": {
|
||||
"winget": "JAMSoftware.TreeSize.Free"
|
||||
},
|
||||
"Installttaskbar": {
|
||||
"winget": "TranslucentTB.TranslucentTB"
|
||||
},
|
||||
"Installvisualstudio": {
|
||||
"winget": "Microsoft.VisualStudio.2022.Community"
|
||||
},
|
||||
"Installvivaldi": {
|
||||
"winget": "VivaldiTechnologies.Vivaldi"
|
||||
},
|
||||
"Installvlc": {
|
||||
"winget": "VideoLAN.VLC"
|
||||
},
|
||||
"Installvoicemeeter": {
|
||||
"winget": "VB-Audio.Voicemeeter"
|
||||
},
|
||||
"Installvscode": {
|
||||
"winget": "Git.Git;Microsoft.VisualStudioCode --source winget"
|
||||
},
|
||||
"Installvscodium": {
|
||||
"winget": "Git.Git;VSCodium.VSCodium"
|
||||
},
|
||||
"Installwindirstat": {
|
||||
"winget": "WinDirStat.WinDirStat"
|
||||
},
|
||||
"Installwinscp": {
|
||||
"winget": "WinSCP.WinSCP"
|
||||
},
|
||||
"Installwireshark": {
|
||||
"winget": "WiresharkFoundation.Wireshark"
|
||||
},
|
||||
"Installzoom": {
|
||||
"winget": "Zoom.Zoom"
|
||||
}
|
||||
}
|
||||
}
|
1456
winutil-test.ps1
1456
winutil-test.ps1
File diff suppressed because it is too large
Load Diff
405
winutil.ps1
405
winutil.ps1
@ -8,13 +8,13 @@
|
||||
# $inputXML = Get-Content "MainWindow.xaml" #uncomment for development
|
||||
$inputXML = (new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/MainWindow.xaml") #uncomment for Production
|
||||
|
||||
$inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window'
|
||||
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
|
||||
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
|
||||
[xml]$XAML = $inputXML
|
||||
#Read XAML
|
||||
|
||||
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
|
||||
try{$Form=[Windows.Markup.XamlReader]::Load( $reader )}
|
||||
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
|
||||
try { $Form = [Windows.Markup.XamlReader]::Load( $reader ) }
|
||||
catch [System.Management.Automation.MethodInvocationException] {
|
||||
Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..."
|
||||
write-host $error[0].Exception.Message -ForegroundColor Red
|
||||
@ -22,24 +22,31 @@ catch [System.Management.Automation.MethodInvocationException] {
|
||||
write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"
|
||||
}
|
||||
}
|
||||
catch{# If it broke some other way <img draggable="false" role="img" class="emoji" alt="😀" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg">
|
||||
catch {
|
||||
# If it broke some other way <img draggable="false" role="img" class="emoji" alt="😀" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg">
|
||||
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
|
||||
}
|
||||
}
|
||||
|
||||
#===========================================================================
|
||||
# Store Form Objects In PowerShell
|
||||
#===========================================================================
|
||||
|
||||
$xaml.SelectNodes("//*[@Name]") | %{Set-Variable -Name "WPF$($_.Name)" -Value $Form.FindName($_.Name)}
|
||||
$xaml.SelectNodes("//*[@Name]") | % { Set-Variable -Name "WPF$($_.Name)" -Value $Form.FindName($_.Name) }
|
||||
|
||||
Function Get-FormVariables{
|
||||
If ($global:ReadmeDisplay -ne $true){Write-host "If you need to reference this display again, run Get-FormVariables" -ForegroundColor Yellow;$global:ReadmeDisplay=$true}
|
||||
write-host "Found the following interactable elements from our form" -ForegroundColor Cyan
|
||||
get-variable WPF*
|
||||
Function Get-FormVariables {
|
||||
If ($global:ReadmeDisplay -ne $true) { Write-host "If you need to reference this display again, run Get-FormVariables" -ForegroundColor Yellow; $global:ReadmeDisplay = $true }
|
||||
write-host "Found the following interactable elements from our form" -ForegroundColor Cyan
|
||||
get-variable WPF*
|
||||
}
|
||||
|
||||
Get-FormVariables
|
||||
|
||||
#===========================================================================
|
||||
# Global Variables
|
||||
#===========================================================================
|
||||
$AppTitle = "Chris Titus Tech's Windows Utility"
|
||||
|
||||
|
||||
#===========================================================================
|
||||
# Navigation Controls
|
||||
#===========================================================================
|
||||
@ -49,7 +56,7 @@ $WPFTab1BT.Add_Click({
|
||||
$WPFTabNav.Items[1].IsSelected = $false
|
||||
$WPFTabNav.Items[2].IsSelected = $false
|
||||
$WPFTabNav.Items[3].IsSelected = $false
|
||||
})
|
||||
})
|
||||
$WPFTab2BT.Add_Click({
|
||||
$WPFTabNav.Items[0].IsSelected = $false
|
||||
$WPFTabNav.Items[1].IsSelected = $true
|
||||
@ -378,38 +385,112 @@ $WPFinstall.Add_Click({
|
||||
$WPFInstallzoom.IsChecked = $false
|
||||
}
|
||||
|
||||
# Check if winget is installed
|
||||
Write-Host "Checking if Winget is Installed..."
|
||||
if (Test-Path ~\AppData\Local\Microsoft\WindowsApps\winget.exe) {
|
||||
#Checks if winget executable exists and if the Windows Version is 1809 or higher
|
||||
Write-Host "Winget Already Installed"
|
||||
}
|
||||
else {
|
||||
if (((((Get-ComputerInfo).OSName.IndexOf("LTSC")) -ne -1) -or ((Get-ComputerInfo).OSName.IndexOf("Server") -ne -1)) -and (((Get-ComputerInfo).WindowsVersion) -ge "1809")) {
|
||||
#Checks if Windows edition is LTSC/Server 2019+
|
||||
#Manually Installing Winget
|
||||
Write-Host "Running Alternative Installer for LTSC/Server Editions"
|
||||
|
||||
#Download Needed Files
|
||||
Write-Host "Downloading Needed Files..."
|
||||
Start-BitsTransfer -Source "https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx" -Destination "./Microsoft.VCLibs.x64.14.00.Desktop.appx"
|
||||
Start-BitsTransfer -Source "https://github.com/microsoft/winget-cli/releases/download/v1.2.10271/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Destination "./Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
|
||||
Start-BitsTransfer -Source "https://github.com/microsoft/winget-cli/releases/download/v1.2.10271/b0a0692da1034339b76dce1c298a1e42_License1.xml" -Destination "./b0a0692da1034339b76dce1c298a1e42_License1.xml"
|
||||
|
||||
#Installing Packages
|
||||
Write-Host "Installing Packages..."
|
||||
Add-AppxProvisionedPackage -Online -PackagePath ".\Microsoft.VCLibs.x64.14.00.Desktop.appx" -SkipLicense
|
||||
Add-AppxProvisionedPackage -Online -PackagePath ".\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -LicensePath ".\b0a0692da1034339b76dce1c298a1e42_License1.xml"
|
||||
Write-Host "winget Installed (Reboot might be required before winget will work)"
|
||||
|
||||
#Sleep for 5 seconds to maximize chance that winget will work without reboot
|
||||
Write-Host "Pausing for 5 seconds to maximize chance that winget will work without reboot"
|
||||
Start-Sleep -s 5
|
||||
|
||||
#Removing no longer needed Files
|
||||
Write-Host "Removing no longer needed Files..."
|
||||
Remove-Item -Path ".\Microsoft.VCLibs.x64.14.00.Desktop.appx" -Force
|
||||
Remove-Item -Path ".\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Force
|
||||
Remove-Item -Path ".\b0a0692da1034339b76dce1c298a1e42_License1.xml" -Force
|
||||
Write-Host "Removed Files that are no longer needed"
|
||||
}
|
||||
elseif (((Get-ComputerInfo).WindowsVersion) -lt "1809") {
|
||||
#Checks if Windows Version is too old for winget
|
||||
Write-Host "Winget is not supported on this version of Windows (Pre-1809)"
|
||||
}
|
||||
else {
|
||||
#Installing Winget from the Microsoft Store
|
||||
Write-Host "Winget not found, installing it now."
|
||||
Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget"
|
||||
$nid = (Get-Process AppInstaller).Id
|
||||
Wait-Process -Id $nid
|
||||
Write-Host "Winget Installed"
|
||||
}
|
||||
}
|
||||
|
||||
if ($wingetinstall.Count -eq 0) {
|
||||
$WarningMsg = "Please select the program(s) to install"
|
||||
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
# Install all winget programs in new window
|
||||
$wingetinstall.ToArray()
|
||||
# Define Output variable
|
||||
$wingetResult = New-Object System.Collections.Generic.List[System.Object]
|
||||
foreach ( $node in $wingetinstall )
|
||||
{
|
||||
foreach ( $node in $wingetinstall ) {
|
||||
try {
|
||||
Start-Process powershell.exe -Verb RunAs -ArgumentList "-command winget install -e --accept-source-agreements --accept-package-agreements --silent $node | Out-Host" -Wait -WindowStyle Maximized
|
||||
$wingetResult.Add("$node`n")
|
||||
}
|
||||
catch [System.InvalidOperationException] {
|
||||
Write-Warning "Allow Yes on User Access Control to Install"
|
||||
}
|
||||
catch {
|
||||
Write-Error $_.Exception
|
||||
}
|
||||
}
|
||||
$wingetResult.ToArray()
|
||||
$wingetResult | % { $_ } | Out-Host
|
||||
|
||||
# Popup after finished
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
$MessageboxTitle = "Installed Programs "
|
||||
$Messageboxbody = ($wingetResult)
|
||||
if ($wingetResult -ne "") {
|
||||
$Messageboxbody = "Installed Programs `n$($wingetResult)"
|
||||
}
|
||||
else {
|
||||
$Messageboxbody = "No Program(s) are installed"
|
||||
}
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$MessageIcon)
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $AppTitle, $ButtonType, $MessageIcon)
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
$WPFInstallUpgrade.Add_Click({
|
||||
$isUpgradeSuccess = $false
|
||||
try {
|
||||
Start-Process powershell.exe -Verb RunAs -ArgumentList "-command winget upgrade --all | Out-Host" -Wait -WindowStyle Maximized
|
||||
|
||||
$isUpgradeSuccess = $true
|
||||
}
|
||||
catch [System.InvalidOperationException] {
|
||||
Write-Warning "Allow Yes on User Access Control to Upgrade"
|
||||
}
|
||||
catch {
|
||||
Write-Error $_.Exception
|
||||
}
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
$MessageboxTitle = "Upgraded All Programs "
|
||||
$Messageboxbody = ("Done")
|
||||
$Messageboxbody = if($isUpgradeSuccess) {"Upgrade Done"} else {"Upgrade was not succesful"}
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$MessageIcon)
|
||||
})
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $AppTitle, $ButtonType, $MessageIcon)
|
||||
})
|
||||
|
||||
#===========================================================================
|
||||
# Tab 2 - Tweak Buttons
|
||||
@ -432,7 +513,7 @@ $WPFdesktop.Add_Click({
|
||||
$WPFMiscTweaksNum.IsChecked = $true
|
||||
$WPFMiscTweaksLapPower.IsChecked = $false
|
||||
$WPFMiscTweaksLapNum.IsChecked = $false
|
||||
})
|
||||
})
|
||||
|
||||
$WPFlaptop.Add_Click({
|
||||
|
||||
@ -452,7 +533,7 @@ $WPFlaptop.Add_Click({
|
||||
$WPFMiscTweaksLapNum.IsChecked = $true
|
||||
$WPFMiscTweaksPower.IsChecked = $false
|
||||
$WPFMiscTweaksNum.IsChecked = $false
|
||||
})
|
||||
})
|
||||
|
||||
$WPFminimal.Add_Click({
|
||||
|
||||
@ -472,7 +553,7 @@ $WPFminimal.Add_Click({
|
||||
$WPFMiscTweaksNum.IsChecked = $false
|
||||
$WPFMiscTweaksLapPower.IsChecked = $false
|
||||
$WPFMiscTweaksLapNum.IsChecked = $false
|
||||
})
|
||||
})
|
||||
|
||||
$WPFtweaksbutton.Add_Click({
|
||||
|
||||
@ -523,14 +604,13 @@ $WPFtweaksbutton.Add_Click({
|
||||
}
|
||||
If ( $WPFEssTweaksOO.IsChecked -eq $true ) {
|
||||
Write-Host "Running O&O Shutup with Recommended Settings"
|
||||
Import-Module BitsTransfer
|
||||
Start-BitsTransfer -Source "https://raw.githubusercontent.com/ChrisTitusTech/win10script/master/ooshutup10.cfg" -Destination ooshutup10.cfg
|
||||
Start-BitsTransfer -Source "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -Destination OOSU10.exe
|
||||
curl.exe -ss "https://raw.githubusercontent.com/ChrisTitusTech/win10script/master/ooshutup10.cfg" -o ooshutup10.cfg
|
||||
curl.exe -ss "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -o OOSU10.exe
|
||||
./OOSU10.exe ooshutup10.cfg /quiet
|
||||
$WPFEssTweaksOO.IsChecked = $false
|
||||
}
|
||||
If ( $WPFEssTweaksRP.IsChecked -eq $true ) {
|
||||
Write-Host "Creating Restore Point incase something bad happens"
|
||||
Write-Host "Creating Restore Point in case something bad happens"
|
||||
Enable-ComputerRestore -Drive "C:\"
|
||||
Checkpoint-Computer -Description "RestorePoint1" -RestorePointType "MODIFY_SETTINGS"
|
||||
$WPFEssTweaksRP.IsChecked = $false
|
||||
@ -715,7 +795,8 @@ $WPFtweaksbutton.Add_Click({
|
||||
Stop-Process $taskmgr
|
||||
$preferences.Preferences[28] = 0
|
||||
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -Type Binary -Value $preferences.Preferences
|
||||
} else {Write-Host "Task Manager patch not run in builds 22557+ due to bug"}
|
||||
}
|
||||
else { Write-Host "Task Manager patch not run in builds 22557+ due to bug" }
|
||||
|
||||
Write-Host "Showing file operations details..."
|
||||
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager")) {
|
||||
@ -741,7 +822,7 @@ $WPFtweaksbutton.Add_Click({
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" -Name "SystemResponsiveness" -Type DWord -Value 0000000a
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" -Name "NetworkThrottlingIndex" -Type DWord -Value 0000000a
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control" -Name "WaitToKillServiceTimeout" -Type DWord -Value 2000
|
||||
Set-ItemProperty -Path "HKLM:\Control Panel\Desktop" -Name "MenuShowDelay" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKLM:\Control Panel\Desktop" -Name "MenuShowDelay" -Type DWord -Value 1
|
||||
Set-ItemProperty -Path "HKLM:\Control Panel\Desktop" -Name "WaitToKillAppTimeout" -Type DWord -Value 5000
|
||||
Set-ItemProperty -Path "HKLM:\Control Panel\Desktop" -Name "HungAppTimeout" -Type DWord -Value 4000
|
||||
Set-ItemProperty -Path "HKLM:\Control Panel\Desktop" -Name "AutoEndTasks" -Type DWord -Value 1
|
||||
@ -834,7 +915,7 @@ $WPFtweaksbutton.Add_Click({
|
||||
Write-Host "Adjusting visual effects for performance..."
|
||||
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Type String -Value 0
|
||||
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type String -Value 200
|
||||
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Type Binary -Value ([byte[]](144,18,3,128,16,0,0,0))
|
||||
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Type Binary -Value ([byte[]](144, 18, 3, 128, 16, 0, 0, 0))
|
||||
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Type String -Value 0
|
||||
Set-ItemProperty -Path "HKCU:\Control Panel\Keyboard" -Name "KeyboardDelay" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewAlphaSelect" -Type DWord -Value 0
|
||||
@ -941,7 +1022,7 @@ $WPFtweaksbutton.Add_Click({
|
||||
Write-Host "Removing Bloatware"
|
||||
|
||||
foreach ($Bloat in $Bloatware) {
|
||||
Get-AppxPackage -Name $Bloat| Remove-AppxPackage
|
||||
Get-AppxPackage -Name $Bloat | Remove-AppxPackage
|
||||
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online
|
||||
Write-Host "Trying to remove $Bloat."
|
||||
}
|
||||
@ -954,13 +1035,13 @@ $WPFtweaksbutton.Add_Click({
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$MessageIcon)
|
||||
})
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
})
|
||||
#===========================================================================
|
||||
# Undo All
|
||||
#===========================================================================
|
||||
$WPFundoall.Add_Click({
|
||||
Write-Host "Creating Restore Point incase something bad happens"
|
||||
Write-Host "Creating Restore Point in case something bad happens"
|
||||
Enable-ComputerRestore -Drive "C:\"
|
||||
Checkpoint-Computer -Description "RestorePoint1" -RestorePointType "MODIFY_SETTINGS"
|
||||
|
||||
@ -1072,7 +1153,7 @@ $WPFundoall.Add_Click({
|
||||
Write-Output "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" -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
|
||||
@ -1093,44 +1174,44 @@ $WPFundoall.Add_Click({
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$MessageIcon)
|
||||
})
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
})
|
||||
#===========================================================================
|
||||
# Tab 3 - Config Buttons
|
||||
#===========================================================================
|
||||
$WPFFeatureInstall.Add_Click({
|
||||
|
||||
If ( $WPFFeaturesdotnet.IsChecked -eq $true ) {
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "NetFx4-AdvSrvs" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "NetFx4-AdvSrvs" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -All -NoRestart
|
||||
}
|
||||
If ( $WPFFeatureshyperv.IsChecked -eq $true ) {
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "HypervisorPlatform" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-All" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Tools-All" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Management-PowerShell" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Hypervisor" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Services" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Management-Clients" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "HypervisorPlatform" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-All" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Tools-All" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Management-PowerShell" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Hypervisor" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Services" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-Management-Clients" -All -NoRestart
|
||||
cmd /c bcdedit /set hypervisorschedulertype classic
|
||||
Write-Host "HyperV is now installed and configured. Please Reboot before using."
|
||||
}
|
||||
If ( $WPFFeatureslegacymedia.IsChecked -eq $true ) {
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "WindowsMediaPlayer" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "MediaPlayback" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "DirectPlay" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "LegacyComponents" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "WindowsMediaPlayer" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "MediaPlayback" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "DirectPlay" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "LegacyComponents" -All -NoRestart
|
||||
}
|
||||
If ( $WPFFeaturewsl.IsChecked -eq $true ) {
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -All -NoRestart
|
||||
Write-Host "WSL is now installed and configured. Please Reboot before using."
|
||||
}
|
||||
If ( $WPFFeaturenfs.IsChecked -eq $true ) {
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "ServicesForNFS-ClientOnly" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "ClientForNFS-Infrastructure" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "NFS-Administration" -All
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "ServicesForNFS-ClientOnly" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "ClientForNFS-Infrastructure" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "NFS-Administration" -All -NoRestart
|
||||
nfsadmin client stop
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "AnonymousUID" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "AnonymousGID" -Type DWord -Value 0
|
||||
@ -1143,52 +1224,60 @@ $WPFFeatureInstall.Add_Click({
|
||||
$Messageboxbody = ("Done")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$MessageIcon)
|
||||
})
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
})
|
||||
|
||||
$WPFPanelDISM.Add_Click({
|
||||
Start-Process PowerShell -ArgumentList "Write-Host '(1/4) Chkdsk' -ForegroundColor Green; Chkdsk /scan;
|
||||
Write-Host '`n(2/4) SFC - 1st scan' -ForegroundColor Green; sfc /scannow;
|
||||
Write-Host '`n(3/4) DISM' -ForegroundColor Green; DISM /Online /Cleanup-Image /Restorehealth;
|
||||
Write-Host '`n(4/4) SFC - 2nd scan' -ForegroundColor Green; sfc /scannow;
|
||||
Read-Host '`nPress Enter to Continue'" -verb runas
|
||||
})
|
||||
|
||||
$WPFPanelcontrol.Add_Click({
|
||||
cmd /c control
|
||||
})
|
||||
})
|
||||
$WPFPanelnetwork.Add_Click({
|
||||
cmd /c ncpa.cpl
|
||||
})
|
||||
cmd /c ncpa.cpl
|
||||
})
|
||||
$WPFPanelpower.Add_Click({
|
||||
cmd /c powercfg.cpl
|
||||
})
|
||||
cmd /c powercfg.cpl
|
||||
})
|
||||
$WPFPanelsound.Add_Click({
|
||||
cmd /c mmsys.cpl
|
||||
})
|
||||
cmd /c mmsys.cpl
|
||||
})
|
||||
$WPFPanelsystem.Add_Click({
|
||||
cmd /c sysdm.cpl
|
||||
})
|
||||
cmd /c sysdm.cpl
|
||||
})
|
||||
$WPFPaneluser.Add_Click({
|
||||
cmd /c "control userpasswords2"
|
||||
})
|
||||
cmd /c "control userpasswords2"
|
||||
})
|
||||
#===========================================================================
|
||||
# Tab 4 - Updates Buttons
|
||||
#===========================================================================
|
||||
|
||||
$WPFUpdatesdefault.Add_Click({
|
||||
# Source: https://github.com/rgl/windows-vagrant/blob/master/disable-windows-updates.ps1 reversed!
|
||||
# Source: https://github.com/rgl/windows-vagrant/blob/master/disable-windows-updates.ps1 reversed!
|
||||
Set-StrictMode -Version Latest
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$ErrorActionPreference = 'Stop'
|
||||
trap {
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$ErrorActionPreference = 'Stop'
|
||||
trap {
|
||||
Write-Host
|
||||
Write-Host "ERROR: $_"
|
||||
Write-Host (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$','ERROR: $1')
|
||||
Write-Host (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$','ERROR EXCEPTION: $1')
|
||||
Write-Host (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$', 'ERROR: $1')
|
||||
Write-Host (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$', 'ERROR EXCEPTION: $1')
|
||||
Write-Host
|
||||
Write-Host 'Sleeping for 60m to give you time to look around the virtual machine before self-destruction...'
|
||||
Start-Sleep -Seconds (60*60)
|
||||
Start-Sleep -Seconds (60 * 60)
|
||||
Exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# disable automatic updates.
|
||||
# XXX this does not seem to work anymore.
|
||||
# see How to configure automatic updates by using Group Policy or registry settings
|
||||
# at https://support.microsoft.com/en-us/help/328010
|
||||
function New-Directory($path) {
|
||||
# disable automatic updates.
|
||||
# XXX this does not seem to work anymore.
|
||||
# see How to configure automatic updates by using Group Policy or registry settings
|
||||
# at https://support.microsoft.com/en-us/help/328010
|
||||
function New-Directory($path) {
|
||||
$p, $components = $path -split '[\\/]'
|
||||
$components | ForEach-Object {
|
||||
$p = "$p\$_"
|
||||
@ -1197,25 +1286,25 @@ function New-Directory($path) {
|
||||
}
|
||||
}
|
||||
$null
|
||||
}
|
||||
$auPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
|
||||
New-Directory $auPath
|
||||
# set NoAutoUpdate.
|
||||
# 0: Automatic Updates is enabled (default).
|
||||
# 1: Automatic Updates is disabled.
|
||||
New-ItemProperty `
|
||||
}
|
||||
$auPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
|
||||
New-Directory $auPath
|
||||
# set NoAutoUpdate.
|
||||
# 0: Automatic Updates is enabled (default).
|
||||
# 1: Automatic Updates is disabled.
|
||||
New-ItemProperty `
|
||||
-Path $auPath `
|
||||
-Name NoAutoUpdate `
|
||||
-Value 0 `
|
||||
-PropertyType DWORD `
|
||||
-Force `
|
||||
| Out-Null
|
||||
# set AUOptions.
|
||||
# 1: Keep my computer up to date has been disabled in Automatic Updates.
|
||||
# 2: Notify of download and installation.
|
||||
# 3: Automatically download and notify of installation.
|
||||
# 4: Automatically download and scheduled installation.
|
||||
New-ItemProperty `
|
||||
# set AUOptions.
|
||||
# 1: Keep my computer up to date has been disabled in Automatic Updates.
|
||||
# 2: Notify of download and installation.
|
||||
# 3: Automatically download and notify of installation.
|
||||
# 4: Automatically download and scheduled installation.
|
||||
New-ItemProperty `
|
||||
-Path $auPath `
|
||||
-Name AUOptions `
|
||||
-Value 3 `
|
||||
@ -1223,13 +1312,13 @@ New-ItemProperty `
|
||||
-Force `
|
||||
| Out-Null
|
||||
|
||||
# disable Windows Update Delivery Optimization.
|
||||
# NB this applies to Windows 10.
|
||||
# 0: Disabled
|
||||
# 1: PCs on my local network
|
||||
# 3: PCs on my local network, and PCs on the Internet
|
||||
$deliveryOptimizationPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config'
|
||||
If (Test-Path $deliveryOptimizationPath) {
|
||||
# disable Windows Update Delivery Optimization.
|
||||
# NB this applies to Windows 10.
|
||||
# 0: Disabled
|
||||
# 1: PCs on my local network
|
||||
# 3: PCs on my local network, and PCs on the Internet
|
||||
$deliveryOptimizationPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config'
|
||||
If (Test-Path $deliveryOptimizationPath) {
|
||||
New-ItemProperty `
|
||||
-Path $deliveryOptimizationPath `
|
||||
-Name DODownloadMode `
|
||||
@ -1237,20 +1326,20 @@ If (Test-Path $deliveryOptimizationPath) {
|
||||
-PropertyType DWORD `
|
||||
-Force `
|
||||
| Out-Null
|
||||
}
|
||||
# Service tweaks for Windows Update
|
||||
}
|
||||
# Service tweaks for Windows Update
|
||||
|
||||
$services = @(
|
||||
$services = @(
|
||||
"BITS"
|
||||
"wuauserv"
|
||||
)
|
||||
)
|
||||
|
||||
foreach ($service in $services) {
|
||||
foreach ($service in $services) {
|
||||
# -ErrorAction SilentlyContinue is so it doesn't write an error to stdout if a service doesn't exist
|
||||
|
||||
Write-Host "Setting $service StartupType to Automatic"
|
||||
Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Automatic
|
||||
}
|
||||
}
|
||||
Write-Host "Enabling driver offering through Windows Update..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata" -Name "PreventDeviceMetadataFromNetwork" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DontPromptForWindowsUpdate" -ErrorAction SilentlyContinue
|
||||
@ -1264,7 +1353,8 @@ foreach ($service in $services) {
|
||||
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
|
||||
|
||||
})
|
||||
$WPFFixesUpdate.Add_Click({
|
||||
### Reset Windows Update Script - reregister dlls, services, and remove registry entires.
|
||||
Write-Host "1. Stopping Windows Update Services..."
|
||||
Stop-Service -Name BITS
|
||||
@ -1272,6 +1362,8 @@ foreach ($service in $services) {
|
||||
Stop-Service -Name appidsvc
|
||||
Stop-Service -Name cryptsvc
|
||||
|
||||
|
||||
|
||||
Write-Host "2. Remove QMGR Data file..."
|
||||
Remove-Item "$env:allusersprofile\Application Data\Microsoft\Network\Downloader\qmgr*.dat" -ErrorAction SilentlyContinue
|
||||
|
||||
@ -1339,9 +1431,10 @@ foreach ($service in $services) {
|
||||
Get-BitsTransfer | Remove-BitsTransfer
|
||||
|
||||
Write-Host "10) Attempting to install the Windows Update Agent..."
|
||||
If ($arch -eq 64) {
|
||||
If (!((wmic OS get OSArchitecture | Out-String).IndexOf("64") -eq -1)) {
|
||||
wusa Windows8-RT-KB2937636-x64 /quiet
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
wusa Windows8-RT-KB2937636-x86 /quiet
|
||||
}
|
||||
|
||||
@ -1361,29 +1454,29 @@ foreach ($service in $services) {
|
||||
$Messageboxbody = ("Stock settings loaded.`n Please reboot your computer")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$MessageIcon)
|
||||
})
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
})
|
||||
$WPFUpdatesdisable.Add_Click({
|
||||
# Source: https://github.com/rgl/windows-vagrant/blob/master/disable-windows-updates.ps1
|
||||
Set-StrictMode -Version Latest
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$ErrorActionPreference = 'Stop'
|
||||
trap {
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$ErrorActionPreference = 'Stop'
|
||||
trap {
|
||||
Write-Host
|
||||
Write-Host "ERROR: $_"
|
||||
Write-Host (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$','ERROR: $1')
|
||||
Write-Host (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$','ERROR EXCEPTION: $1')
|
||||
Write-Host (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$', 'ERROR: $1')
|
||||
Write-Host (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$', 'ERROR EXCEPTION: $1')
|
||||
Write-Host
|
||||
Write-Host 'Sleeping for 60m to give you time to look around the virtual machine before self-destruction...'
|
||||
Start-Sleep -Seconds (60*60)
|
||||
Start-Sleep -Seconds (60 * 60)
|
||||
Exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# disable automatic updates.
|
||||
# XXX this does not seem to work anymore.
|
||||
# see How to configure automatic updates by using Group Policy or registry settings
|
||||
# at https://support.microsoft.com/en-us/help/328010
|
||||
function New-Directory($path) {
|
||||
# disable automatic updates.
|
||||
# XXX this does not seem to work anymore.
|
||||
# see How to configure automatic updates by using Group Policy or registry settings
|
||||
# at https://support.microsoft.com/en-us/help/328010
|
||||
function New-Directory($path) {
|
||||
$p, $components = $path -split '[\\/]'
|
||||
$components | ForEach-Object {
|
||||
$p = "$p\$_"
|
||||
@ -1392,25 +1485,25 @@ function New-Directory($path) {
|
||||
}
|
||||
}
|
||||
$null
|
||||
}
|
||||
$auPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
|
||||
New-Directory $auPath
|
||||
# set NoAutoUpdate.
|
||||
# 0: Automatic Updates is enabled (default).
|
||||
# 1: Automatic Updates is disabled.
|
||||
New-ItemProperty `
|
||||
}
|
||||
$auPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
|
||||
New-Directory $auPath
|
||||
# set NoAutoUpdate.
|
||||
# 0: Automatic Updates is enabled (default).
|
||||
# 1: Automatic Updates is disabled.
|
||||
New-ItemProperty `
|
||||
-Path $auPath `
|
||||
-Name NoAutoUpdate `
|
||||
-Value 1 `
|
||||
-PropertyType DWORD `
|
||||
-Force `
|
||||
| Out-Null
|
||||
# set AUOptions.
|
||||
# 1: Keep my computer up to date has been disabled in Automatic Updates.
|
||||
# 2: Notify of download and installation.
|
||||
# 3: Automatically download and notify of installation.
|
||||
# 4: Automatically download and scheduled installation.
|
||||
New-ItemProperty `
|
||||
# set AUOptions.
|
||||
# 1: Keep my computer up to date has been disabled in Automatic Updates.
|
||||
# 2: Notify of download and installation.
|
||||
# 3: Automatically download and notify of installation.
|
||||
# 4: Automatically download and scheduled installation.
|
||||
New-ItemProperty `
|
||||
-Path $auPath `
|
||||
-Name AUOptions `
|
||||
-Value 1 `
|
||||
@ -1418,13 +1511,13 @@ New-ItemProperty `
|
||||
-Force `
|
||||
| Out-Null
|
||||
|
||||
# disable Windows Update Delivery Optimization.
|
||||
# NB this applies to Windows 10.
|
||||
# 0: Disabled
|
||||
# 1: PCs on my local network
|
||||
# 3: PCs on my local network, and PCs on the Internet
|
||||
$deliveryOptimizationPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config'
|
||||
If (Test-Path $deliveryOptimizationPath) {
|
||||
# disable Windows Update Delivery Optimization.
|
||||
# NB this applies to Windows 10.
|
||||
# 0: Disabled
|
||||
# 1: PCs on my local network
|
||||
# 3: PCs on my local network, and PCs on the Internet
|
||||
$deliveryOptimizationPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config'
|
||||
If (Test-Path $deliveryOptimizationPath) {
|
||||
New-ItemProperty `
|
||||
-Path $deliveryOptimizationPath `
|
||||
-Name DODownloadMode `
|
||||
@ -1432,22 +1525,22 @@ If (Test-Path $deliveryOptimizationPath) {
|
||||
-PropertyType DWORD `
|
||||
-Force `
|
||||
| Out-Null
|
||||
}
|
||||
# Service tweaks for Windows Update
|
||||
}
|
||||
# Service tweaks for Windows Update
|
||||
|
||||
$services = @(
|
||||
$services = @(
|
||||
"BITS"
|
||||
"wuauserv"
|
||||
)
|
||||
)
|
||||
|
||||
foreach ($service in $services) {
|
||||
foreach ($service in $services) {
|
||||
# -ErrorAction SilentlyContinue is so it doesn't write an error to stdout if a service doesn't exist
|
||||
|
||||
Write-Host "Setting $service StartupType to Disabled"
|
||||
Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
$WPFUpdatessecurity.Add_Click({
|
||||
Write-Host "Disabling driver offering through Windows Update..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata")) {
|
||||
@ -1480,8 +1573,8 @@ $WPFUpdatessecurity.Add_Click({
|
||||
$Messageboxbody = ("Recommended Update settings loaded")
|
||||
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||||
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$MessageIcon)
|
||||
})
|
||||
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
})
|
||||
|
||||
#===========================================================================
|
||||
# Shows the form
|
||||
|
Loading…
Reference in New Issue
Block a user