From 74cc668ce1cd056bd95c06f691dda8d370fa4cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pl=C3=ADnio=20Larrubia?= Date: Sat, 2 Apr 2022 22:00:10 -0300 Subject: [PATCH] Refactor Install-Software function - Improve general terminal output - Rename Write-ScriptLogo function - Refactor Install Drivers Updaters - Refactor Install Gaming Dependencies - Refactor Git + GnuPG + SSH (Setup) - Rename src/lib/show-message-box => src/lib/show-dialog-window - Refactor Show-Question 'Switch Cases' - Add option to have no dialog on file runner for PS and Reg files - Use file-runner for personal-tweaks - Change line break on title-templates --- Win10ScriptCLI.ps1 | 20 +-- Win10ScriptGUI.ps1 | 167 +++++++++--------- src/lib/download-web-file.psm1 | 1 + src/lib/file-runner.psm1 | 17 +- src/lib/get-os-info.psm1 | 8 +- src/lib/install-software.psm1 | 28 +-- src/lib/remove-uwp-apps.psm1 | 6 +- ...ssage-box.psm1 => show-dialog-window.psm1} | 7 +- src/lib/title-templates.psm1 | 17 +- src/scripts/backup-system.ps1 | 3 - src/scripts/install-drivers-updaters.ps1 | 73 ++++---- src/scripts/install-gaming-dependencies.ps1 | 74 ++++---- src/scripts/install-package-managers.ps1 | 5 +- src/scripts/personal-tweaks.ps1 | 17 +- src/scripts/remove-and-disable-xbox.ps1 | 80 ++++----- src/scripts/remove-bloatware-apps.ps1 | 2 +- src/utils/git-gnupg-ssh-keys-setup.ps1 | 27 ++- 17 files changed, 267 insertions(+), 285 deletions(-) rename src/lib/{show-message-box.psm1 => show-dialog-window.psm1} (93%) diff --git a/Win10ScriptCLI.ps1 b/Win10ScriptCLI.ps1 index 0d9ae12a..0d97b403 100644 --- a/Win10ScriptCLI.ps1 +++ b/Win10ScriptCLI.ps1 @@ -4,8 +4,7 @@ function Request-AdminPrivilege() { } function Open-Script() { - - $DoneTitle = "Done" + $DoneTitle = "Information" $DoneMessage = "Process Completed!" $Scripts = @( @@ -28,26 +27,23 @@ function Open-Script() { } function Main() { - Request-AdminPrivilege # Check admin rights - - Write-Host "Your Current Folder $pwd" - Write-Host "Script Root Folder $PSScriptRoot" Get-ChildItem -Recurse $PSScriptRoot\*.ps*1 | Unblock-File Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\set-console-style.psm1" Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"file-runner.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\set-script-policy.psm1" - Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\show-message-box.psm1" + Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\show-dialog-window.psm1" Import-Module -DisableNameChecking "$PSScriptRoot\src\lib\title-templates.psm1" - Set-ConsoleStyle # Makes the console look cooler + Write-Host "Your Current Folder $pwd" + Write-Host "Script Root Folder $PSScriptRoot" + Set-ConsoleStyle # Makes the console look cooler Unlock-ScriptUsage - Open-Script # Run all scripts inside 'scripts' folder + Open-Script # Run all scripts inside 'scripts' folder Block-ScriptUsage - Write-ASCIIScriptName # Thanks Figlet - Request-PcRestart # Prompt options to Restart the PC - + Write-ScriptLogo # Thanks Figlet + Request-PcRestart # Prompt options to Restart the PC } Main \ No newline at end of file diff --git a/Win10ScriptGUI.ps1 b/Win10ScriptGUI.ps1 index 8935b362..841acaa5 100644 --- a/Win10ScriptGUI.ps1 +++ b/Win10ScriptGUI.ps1 @@ -10,7 +10,7 @@ function Show-GUI() { Set-GUILayout # Load the GUI Layout $Global:NeedRestart = $false - $DoneTitle = "Done" + $DoneTitle = "Information" $DoneMessage = "Process Completed!" # Main Window: @@ -645,103 +645,103 @@ function Show-GUI() { }) $BraveBrowser.Add_Click( { - Install-Software -Name $BraveBrowser.Text -PackageName "BraveSoftware.BraveBrowser" + Install-Software -Name $BraveBrowser.Text -Packages "BraveSoftware.BraveBrowser" }) $GoogleChrome.Add_Click( { - Install-Software -Name $GoogleChrome.Text -PackageName "Google.Chrome" -InstallBlock { winget install --silent --source "winget" --id $Package; choco install -y "ublockorigin-chrome" } + Install-Software -Name $GoogleChrome.Text -Packages "Google.Chrome" -InstallBlock { winget install --silent --source "winget" --id $Package; choco install -y "ublockorigin-chrome" } }) $MozillaFirefox.Add_Click( { - Install-Software -Name $MozillaFirefox.Text -PackageName "Mozilla.Firefox" + Install-Software -Name $MozillaFirefox.Text -Packages "Mozilla.Firefox" }) $7Zip.Add_Click( { - Install-Software -Name $7Zip.Text -PackageName "7zip.7zip" + Install-Software -Name $7Zip.Text -Packages "7zip.7zip" }) $WinRAR.Add_Click( { - Install-Software -Name $WinRAR.Text -PackageName "RARLab.WinRAR" + Install-Software -Name $WinRAR.Text -Packages "RARLab.WinRAR" }) $OnlyOffice.Add_Click( { - Install-Software -Name $OnlyOffice.Text -PackageName "ONLYOFFICE.DesktopEditors" + Install-Software -Name $OnlyOffice.Text -Packages "ONLYOFFICE.DesktopEditors" }) $LibreOffice.Add_Click( { - Install-Software -Name $LibreOffice.Text -PackageName "LibreOffice.LibreOffice" + Install-Software -Name $LibreOffice.Text -Packages "LibreOffice.LibreOffice" }) $PowerBI.Add_Click( { - Install-Software -Name $PowerBI.Text -PackageName "Microsoft.PowerBI" + Install-Software -Name $PowerBI.Text -Packages "Microsoft.PowerBI" }) $PaintNet.Add_Click( { - Install-Software -Name $PaintNet.Text -PackageName "paint.net" -InstallBlock { choco install -y $Package } + Install-Software -Name $PaintNet.Text -Packages "paint.net" -InstallBlock { choco install -y $Package } }) $Gimp.Add_Click( { - Install-Software -Name $Gimp.Text -PackageName "GIMP.GIMP" + Install-Software -Name $Gimp.Text -Packages "GIMP.GIMP" }) $Inkscape.Add_Click( { - Install-Software -Name $Inkscape.Text -PackageName "Inkscape.Inkscape" + Install-Software -Name $Inkscape.Text -Packages "Inkscape.Inkscape" }) $IrfanView.Add_Click( { - Install-Software -Name $IrfanView.Text -PackageName "IrfanSkiljan.IrfanView" + Install-Software -Name $IrfanView.Text -Packages "IrfanSkiljan.IrfanView" }) $Krita.Add_Click( { - Install-Software -Name $Krita.Text -PackageName "KDE.Krita" + Install-Software -Name $Krita.Text -Packages "KDE.Krita" }) $ShareX.Add_Click( { - Install-Software -Name $ShareX.Text -PackageName "ShareX.ShareX" + Install-Software -Name $ShareX.Text -Packages "ShareX.ShareX" }) $VSCode.Add_Click( { - Install-Software -Name $VSCode.Text -PackageName "Microsoft.VisualStudioCode" + Install-Software -Name $VSCode.Text -Packages "Microsoft.VisualStudioCode" }) $NotepadPlusPlus.Add_Click( { - Install-Software -Name $NotepadPlusPlus.Text -PackageName "Notepad++.Notepad++" + Install-Software -Name $NotepadPlusPlus.Text -Packages "Notepad++.Notepad++" }) $GoogleDrive.Add_Click( { - Install-Software -Name $GoogleDrive.Text -PackageName "Google.Drive" + Install-Software -Name $GoogleDrive.Text -Packages "Google.Drive" }) $Dropbox.Add_Click( { - Install-Software -Name $Dropbox.Text -PackageName "Dropbox.Dropbox" + Install-Software -Name $Dropbox.Text -Packages "Dropbox.Dropbox" }) $Zotero.Add_Click( { - Install-Software -Name $Zotero.Text -PackageName "Zotero.Zotero" + Install-Software -Name $Zotero.Text -Packages "Zotero.Zotero" }) $RadminVPN.Add_Click( { - Install-Software -Name $RadminVPN.Text -PackageName "Radmin.VPN" + Install-Software -Name $RadminVPN.Text -Packages "Radmin.VPN" }) $Hamachi.Add_Click( { - Install-Software -Name $Hamachi.Text -PackageName "LogMeIn.Hamachi" + Install-Software -Name $Hamachi.Text -Packages "LogMeIn.Hamachi" }) $TwilioAuthy.Add_Click( { - Install-Software -Name $TwilioAuthy.Text -PackageName "Twilio.Authy" + Install-Software -Name $TwilioAuthy.Text -Packages "Twilio.Authy" }) $Ventoy.Add_Click( { - Install-Software -Name $Ventoy.Text -PackageName "Ventoy" -InstallBlock { choco install -y $Package } + Install-Software -Name $Ventoy.Text -Packages "Ventoy" -InstallBlock { choco install -y $Package } }) $Rufus.Add_Click( { - Install-Software -Name $Rufus.Text -PackageName "9PC3H3V7Q9CH" -InstallBlock { winget install --source "msstore" --id $Package --accept-package-agreements } + Install-Software -Name $Rufus.Text -Packages "9PC3H3V7Q9CH" -InstallBlock { winget install --source "msstore" --id $Package --accept-package-agreements } }) $BalenaEtcher.Add_Click( { - Install-Software -Name $BalenaEtcher.Text -PackageName "Balena.Etcher" + Install-Software -Name $BalenaEtcher.Text -Packages "Balena.Etcher" }) $WindowsTerminalNerdFonts.Add_Click( { @@ -753,7 +753,7 @@ function Show-GUI() { } Install-Font -FontSourceFolder "$PSScriptRoot\src\tmp\Fonts" - Install-Software -Name $WindowsTerminalNerdFonts.Text -PackageName "Microsoft.WindowsTerminal" + Install-Software -Name $WindowsTerminalNerdFonts.Text -Packages "Microsoft.WindowsTerminal" }) $GitGnupgSshSetup.Add_Click( { @@ -762,55 +762,55 @@ function Show-GUI() { }) $JavaJRE.Add_Click( { - Install-Software -Name $JavaJRE.Text -PackageName "Oracle.JavaRuntimeEnvironment" + Install-Software -Name $JavaJRE.Text -Packages "Oracle.JavaRuntimeEnvironment" }) $JavaJDKs.Add_Click( { - Install-Software -Name $JavaJDKs.Text -PackageName @("EclipseAdoptium.Temurin.8", "EclipseAdoptium.Temurin.11", "EclipseAdoptium.Temurin.17") + Install-Software -Name $JavaJDKs.Text -Packages @("EclipseAdoptium.Temurin.8", "EclipseAdoptium.Temurin.11", "EclipseAdoptium.Temurin.17") }) $NodeJsLts.Add_Click( { - Install-Software -Name $NodeJsLts.Text -PackageName "OpenJS.NodeJSLTS" + Install-Software -Name $NodeJsLts.Text -Packages "OpenJS.NodeJSLTS" }) $NodeJs.Add_Click( { - Install-Software -Name $NodeJs.Text -PackageName "OpenJS.NodeJS" + Install-Software -Name $NodeJs.Text -Packages "OpenJS.NodeJS" }) $Python3.Add_Click( { - Install-Software -Name $Python3.Text -PackageName "Python.Python.3" + Install-Software -Name $Python3.Text -Packages "Python.Python.3" }) $Anaconda3.Add_Click( { - Install-Software -Name $Anaconda3.Text -PackageName "Anaconda.Anaconda3" + Install-Software -Name $Anaconda3.Text -Packages "Anaconda.Anaconda3" }) $Ruby.Add_Click( { - Install-Software -Name $Ruby.Text -PackageName "RubyInstallerTeam.RubyWithDevKit" + Install-Software -Name $Ruby.Text -Packages "RubyInstallerTeam.RubyWithDevKit" }) $ADB.Add_Click( { - Install-Software -Name $ADB.Text -PackageName "adb" -InstallBlock { choco install -y $Package } + Install-Software -Name $ADB.Text -Packages "adb" -InstallBlock { choco install -y $Package } }) $AndroidStudio.Add_Click( { - Install-Software -Name $AndroidStudio.Text -PackageName "Google.AndroidStudio" + Install-Software -Name $AndroidStudio.Text -Packages "Google.AndroidStudio" }) $DockerDesktop.Add_Click( { - Install-Software -Name $DockerDesktop.Text -PackageName "Docker.DockerDesktop" + Install-Software -Name $DockerDesktop.Text -Packages "Docker.DockerDesktop" }) $PostgreSQL.Add_Click( { - Install-Software -Name $PostgreSQL.Text -PackageName "PostgreSQL.PostgreSQL" + Install-Software -Name $PostgreSQL.Text -Packages "PostgreSQL.PostgreSQL" }) $MySQL.Add_Click( { - Install-Software -Name $MySQL.Text -PackageName "Oracle.MySQL" + Install-Software -Name $MySQL.Text -Packages "Oracle.MySQL" }) $Insomnia.Add_Click( { - Install-Software -Name $Insomnia.Text -PackageName "Insomnia.Insomnia" + Install-Software -Name $Insomnia.Text -Packages "Insomnia.Insomnia" }) $InstallGamingDependencies.Add_Click( { @@ -819,119 +819,119 @@ function Show-GUI() { }) $Discord.Add_Click( { - Install-Software -Name $Discord.Text -PackageName "Discord.Discord" + Install-Software -Name $Discord.Text -Packages "Discord.Discord" }) $MSTeams.Add_Click( { - Install-Software -Name $MSTeams.Text -PackageName "Microsoft.Teams" + Install-Software -Name $MSTeams.Text -Packages "Microsoft.Teams" }) $Slack.Add_Click( { - Install-Software -Name $Slack.Text -PackageName "SlackTechnologies.Slack" + Install-Software -Name $Slack.Text -Packages "SlackTechnologies.Slack" }) $Zoom.Add_Click( { - Install-Software -Name $Zoom.Text -PackageName "Zoom.Zoom" + Install-Software -Name $Zoom.Text -Packages "Zoom.Zoom" }) $Telegram.Add_Click( { - Install-Software -Name $Telegram.Text -PackageName "Telegram.TelegramDesktop" + Install-Software -Name $Telegram.Text -Packages "Telegram.TelegramDesktop" }) $RocketChat.Add_Click( { - Install-Software -Name $RocketChat.Text -PackageName "RocketChat.RocketChat" + Install-Software -Name $RocketChat.Text -Packages "RocketChat.RocketChat" }) $Steam.Add_Click( { - Install-Software -Name $Steam.Text -PackageName "Valve.Steam" + Install-Software -Name $Steam.Text -Packages "Valve.Steam" }) $GogGalaxy.Add_Click( { - Install-Software -Name $GogGalaxy.Text -PackageName "GOG.Galaxy" + Install-Software -Name $GogGalaxy.Text -Packages "GOG.Galaxy" }) $EpicGames.Add_Click( { - Install-Software -Name $EpicGames.Text -PackageName "EpicGames.EpicGamesLauncher" + Install-Software -Name $EpicGames.Text -Packages "EpicGames.EpicGamesLauncher" }) $EADesktop.Add_Click( { - Install-Software -Name $EADesktop.Text -PackageName "ElectronicArts.EADesktop" + Install-Software -Name $EADesktop.Text -Packages "ElectronicArts.EADesktop" }) $UbisoftConnect.Add_Click( { - Install-Software -Name $UbisoftConnect.Text -PackageName "Ubisoft.Connect" + Install-Software -Name $UbisoftConnect.Text -Packages "Ubisoft.Connect" }) $BorderlessGaming.Add_Click( { - Install-Software -Name $BorderlessGaming.Text -PackageName "Codeusa.BorderlessGaming" + Install-Software -Name $BorderlessGaming.Text -Packages "Codeusa.BorderlessGaming" }) $Notion.Add_Click( { - Install-Software -Name $Notion.Text -PackageName "Notion.Notion" + Install-Software -Name $Notion.Text -Packages "Notion.Notion" }) $Parsec.Add_Click( { - Install-Software -Name $Parsec.Text -PackageName "Parsec.Parsec" + Install-Software -Name $Parsec.Text -Packages "Parsec.Parsec" }) $AnyDesk.Add_Click( { - Install-Software -Name $AnyDesk.Text -PackageName "AnyDeskSoftwareGmbH.AnyDesk" + Install-Software -Name $AnyDesk.Text -Packages "AnyDeskSoftwareGmbH.AnyDesk" }) $TeamViewer.Add_Click( { - Install-Software -Name $TeamViewer.Text -PackageName "TeamViewer.TeamViewer" + Install-Software -Name $TeamViewer.Text -Packages "TeamViewer.TeamViewer" }) $AndroidScrCpy.Add_Click( { - Install-Software -Name $AndroidScrCpy.Text -PackageName "scrcpy" -InstallBlock { choco install -y $Package } + Install-Software -Name $AndroidScrCpy.Text -Packages "scrcpy" -InstallBlock { choco install -y $Package } }) $ObsStudio.Add_Click( { - Install-Software -Name $ObsStudio.Text -PackageName "OBSProject.OBSStudio" + Install-Software -Name $ObsStudio.Text -Packages "OBSProject.OBSStudio" }) $StreamlabsObs.Add_Click( { - Install-Software -Name $StreamlabsObs.Text -PackageName "Streamlabs.StreamlabsOBS" + Install-Software -Name $StreamlabsObs.Text -Packages "Streamlabs.StreamlabsOBS" }) $HandBrake.Add_Click( { - Install-Software -Name $HandBrake.Text -PackageName "HandBrake.HandBrake" + Install-Software -Name $HandBrake.Text -Packages "HandBrake.HandBrake" }) $qBittorrent.Add_Click( { - Install-Software -Name $qBittorrent.Text -PackageName "qBittorrent.qBittorrent" + Install-Software -Name $qBittorrent.Text -Packages "qBittorrent.qBittorrent" }) $Vlc.Add_Click( { - Install-Software -Name $Vlc.Text -PackageName "VideoLAN.VLC" + Install-Software -Name $Vlc.Text -Packages "VideoLAN.VLC" }) $MpcHc.Add_Click( { - Install-Software -Name $MpcHc.Text -PackageName "clsid2.mpc-hc" + Install-Software -Name $MpcHc.Text -Packages "clsid2.mpc-hc" }) $Spotify.Add_Click( { - Install-Software -Name $Spotify.Text -PackageName "9NCBCSZSJRSB" -InstallBlock { winget install --source "msstore" --id $Package --accept-package-agreements } + Install-Software -Name $Spotify.Text -Packages "9NCBCSZSJRSB" -InstallBlock { winget install --source "msstore" --id $Package --accept-package-agreements } }) $CPUZ.Add_Click( { - Install-Software -Name $CPUZ.Text -PackageName "CPUID.CPU-Z" + Install-Software -Name $CPUZ.Text -Packages "CPUID.CPU-Z" }) $GPUZ.Add_Click( { - Install-Software -Name $GPUZ.Text -PackageName "TechPowerUp.GPU-Z" + Install-Software -Name $GPUZ.Text -Packages "TechPowerUp.GPU-Z" }) $CrystalDiskInfo.Add_Click( { - Install-Software -Name $CrystalDiskInfo.Text -PackageName "CrystalDewWorld.CrystalDiskInfo" + Install-Software -Name $CrystalDiskInfo.Text -Packages "CrystalDewWorld.CrystalDiskInfo" }) $CrystalDiskMark.Add_Click( { - Install-Software -Name $CrystalDiskMark.Text -PackageName "CrystalDewWorld.CrystalDiskMark" + Install-Software -Name $CrystalDiskMark.Text -Packages "CrystalDewWorld.CrystalDiskMark" }) $NVCleanstall.Add_Click( { - Install-Software -Name $NVCleanstall.Text -PackageName "TechPowerUp.NVCleanstall" + Install-Software -Name $NVCleanstall.Text -Packages "TechPowerUp.NVCleanstall" }) $WSL2.Add_Click( { @@ -945,35 +945,35 @@ function Show-GUI() { }) $Ubuntu.Add_Click( { - Install-Software -Name $Ubuntu.Text -PackageName "Ubuntu" -InstallBlock { wsl --install --distribution $Package } + Install-Software -Name $Ubuntu.Text -Packages "Ubuntu" -InstallBlock { wsl --install --distribution $Package } }) $Debian.Add_Click( { - Install-Software -Name $Debian.Text -PackageName "Debian" -InstallBlock { wsl --install --distribution $Package } + Install-Software -Name $Debian.Text -Packages "Debian" -InstallBlock { wsl --install --distribution $Package } }) $KaliLinux.Add_Click( { - Install-Software -Name $KaliLinux.Text -PackageName "kali-linux" -InstallBlock { wsl --install --distribution $Package } + Install-Software -Name $KaliLinux.Text -Packages "kali-linux" -InstallBlock { wsl --install --distribution $Package } }) $OpenSuse.Add_Click( { - Install-Software -Name $OpenSuse.Text -PackageName "openSUSE-42" -InstallBlock { wsl --install --distribution $Package } + Install-Software -Name $OpenSuse.Text -Packages "openSUSE-42" -InstallBlock { wsl --install --distribution $Package } }) $SLES.Add_Click( { - Install-Software -Name $SLES.Text -PackageName "SLES-12" -InstallBlock { wsl --install --distribution $Package } + Install-Software -Name $SLES.Text -Packages "SLES-12" -InstallBlock { wsl --install --distribution $Package } }) $Ubuntu16LTS.Add_Click( { - Install-Software -Name $Ubuntu16LTS.Text -PackageName "Ubuntu-16.04" -InstallBlock { wsl --install --distribution $Package } + Install-Software -Name $Ubuntu16LTS.Text -Packages "Ubuntu-16.04" -InstallBlock { wsl --install --distribution $Package } }) $Ubuntu18LTS.Add_Click( { - Install-Software -Name $Ubuntu18LTS.Text -PackageName "Ubuntu-18.04" -InstallBlock { wsl --install --distribution $Package } + Install-Software -Name $Ubuntu18LTS.Text -Packages "Ubuntu-18.04" -InstallBlock { wsl --install --distribution $Package } }) $Ubuntu20LTS.Add_Click( { - Install-Software -Name $Ubuntu20LTS.Text -PackageName "Ubuntu-20.04" -InstallBlock { wsl --install --distribution $Package } + Install-Software -Name $Ubuntu20LTS.Text -Packages "Ubuntu-20.04" -InstallBlock { wsl --install --distribution $Package } }) $ArchWSL.Add_Click( { @@ -990,12 +990,8 @@ function Show-GUI() { } function Main() { - Clear-Host Request-AdminPrivilege # Check admin rights - - Write-Host "Your Current Folder $pwd" - Write-Host "Script Root Folder $PSScriptRoot" Get-ChildItem -Recurse $PSScriptRoot\*.ps*1 | Unblock-File Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"set-console-style.psm1" @@ -1006,13 +1002,15 @@ function Main() { Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"install-font.psm1" Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"install-software.psm1" Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"set-script-policy.psm1" - Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"show-message-box.psm1" + Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"show-dialog-window.psm1" Import-Module -DisableNameChecking $PSScriptRoot\src\lib\"title-templates.psm1" + Write-Host "Your Current Folder $pwd" + Write-Host "Script Root Folder $PSScriptRoot" Set-ConsoleStyle # Makes the console look cooler Unlock-ScriptUsage - Open-PowerShellFilesCollection -RelativeLocation "src\scripts" -Scripts "install-package-managers.ps1" -DoneTitle $DoneTitle -DoneMessage $DoneMessage -ShowDoneWindow $false # Install Winget and Chocolatey at the beginning - Write-ASCIIScriptName # Thanks Figlet + Open-PowerShellFilesCollection -RelativeLocation "src\scripts" -Scripts "install-package-managers.ps1" -DoneTitle $DoneTitle -DoneMessage $DoneMessage -NoDialog # Install Winget and Chocolatey at the beginning + Write-ScriptLogo # Thanks Figlet Show-GUI # Load the GUI Write-Verbose "Restart: $Global:NeedRestart" @@ -1020,7 +1018,6 @@ function Main() { Request-PcRestart # Prompt options to Restart the PC } Block-ScriptUsage - } Main \ No newline at end of file diff --git a/src/lib/download-web-file.psm1 b/src/lib/download-web-file.psm1 index 1e91ea9d..a13db0d8 100644 --- a/src/lib/download-web-file.psm1 +++ b/src/lib/download-web-file.psm1 @@ -1,5 +1,6 @@ function Request-FileDownload { [CmdletBinding()] + [OutputType([String])] param ( [String] $FileURI, [Parameter(Mandatory = $false)] diff --git a/src/lib/file-runner.psm1 b/src/lib/file-runner.psm1 index 16348d6d..562f2d83 100644 --- a/src/lib/file-runner.psm1 +++ b/src/lib/file-runner.psm1 @@ -1,4 +1,4 @@ -Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-message-box.psm1" +Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1" Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1" function Open-PowerShellFilesCollection { @@ -8,9 +8,9 @@ function Open-PowerShellFilesCollection { [String] $DoneTitle, [String] $DoneMessage, [Parameter(Mandatory = $false)] - [Bool] $ShowDoneWindow = $true, + [Bool] $OpenFromGUI = $true, [Parameter(Mandatory = $false)] - [Bool] $OpenFromGUI = $true + [Switch] $NoDialog ) Push-Location -Path "$PSScriptRoot\..\..\$RelativeLocation" @@ -28,7 +28,7 @@ function Open-PowerShellFilesCollection { Pop-Location - If ($ShowDoneWindow) { + If (!($NoDialog)) { Show-Message -Title "$DoneTitle" -Message "$DoneMessage" } } @@ -38,7 +38,9 @@ function Open-RegFilesCollection { [String] $RelativeLocation, [Array] $Scripts, [String] $DoneTitle, - [String] $DoneMessage + [String] $DoneMessage, + [Parameter(Mandatory = $false)] + [Switch] $NoDialog ) Push-Location -Path "$PSScriptRoot\..\..\$RelativeLocation" @@ -49,5 +51,8 @@ function Open-RegFilesCollection { } Pop-Location - Show-Message -Title "$DoneTitle" -Message "$DoneMessage" + + If (!($NoDialog)) { + Show-Message -Title "$DoneTitle" -Message "$DoneMessage" + } } \ No newline at end of file diff --git a/src/lib/get-os-info.psm1 b/src/lib/get-os-info.psm1 index 8ecd7965..eac44a38 100644 --- a/src/lib/get-os-info.psm1 +++ b/src/lib/get-os-info.psm1 @@ -1,5 +1,7 @@ function Get-CPU() { - [CmdletBinding()] param () + [CmdletBinding()] + [OutputType([String])] + param () $CPUName = (Get-ItemProperty "HKLM:\HARDWARE\DESCRIPTION\System\CentralProcessor\0").ProcessorNameString.Trim(" ") $CPUCoresAndThreads = "($((Get-WmiObject -class Win32_processor).NumberOfCores)C/$env:NUMBER_OF_PROCESSORS`rT)" @@ -49,7 +51,9 @@ function Get-OSArchitecture() { } function Get-OSDriveType() { - [CmdletBinding()] param () + [CmdletBinding()] + [OutputType([String])] + param () # Adapted from: https://stackoverflow.com/a/62087930 $SystemDriveType = Get-PhysicalDisk | ForEach-Object { diff --git a/src/lib/install-software.psm1 b/src/lib/install-software.psm1 index ada54362..ba5dc5c3 100644 --- a/src/lib/install-software.psm1 +++ b/src/lib/install-software.psm1 @@ -1,25 +1,25 @@ +Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1" +Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1" + function Install-Software() { [CmdletBinding()] param ( [String] $Name, - [Array] $PackageName, + [Array] $Packages, [ScriptBlock] $InstallBlock = { winget install --silent --source "winget" --id $Package }, [Parameter(Mandatory = $false)] - [Switch] $NoDialog + [Switch] $NoDialog ) - $DoneTitle = "Done" + $DoneTitle = "Information" $DoneMessage = "$Name installed successfully!" - Write-Host "==> Installing: $($Name)" -ForegroundColor Cyan - # Avoiding a softlock only on the script that occurs if the APP is already installed on Microsoft Store (Blame Spotify) - If ((Get-AppxPackage).Name -ilike "*$($Name)*") { - Write-Host "==> $PackageName is already installed on MS Store!`nSkipping..." -ForegroundColor Cyan - } - Else { - ForEach ($Package in $PackageName) { - Invoke-Expression "$InstallBlock" | Out-Host - } + Clear-Host + Write-Title "Installing: $($Name)" + + ForEach ($Package in $Packages) { + Write-TitleCounter -Text "Installing: $Package" -MaxNum $Packages.Length + Invoke-Expression "$InstallBlock" | Out-Host } If (!($NoDialog)) { @@ -29,6 +29,6 @@ function Install-Software() { <# Example: -Install-Software -Name "Brave Browser" -PackageName "BraveSoftware.BraveBrowser" -Install-Software -Name "Multiple Packages" -PackageName @("Package1", "Package2", "Package3", ...) -InstallBlock { choco install -y $Package } +Install-Software -Name "Brave Browser" -Packages "BraveSoftware.BraveBrowser" +Install-Software -Name "Multiple Packages" -Packages @("Package1", "Package2", "Package3", ...) -InstallBlock { choco install -y $Package } #> \ No newline at end of file diff --git a/src/lib/remove-uwp-apps.psm1 b/src/lib/remove-uwp-apps.psm1 index 7414e85f..a4b11b4d 100644 --- a/src/lib/remove-uwp-apps.psm1 +++ b/src/lib/remove-uwp-apps.psm1 @@ -6,16 +6,12 @@ function Remove-UWPAppsList() { ForEach ($Bloat in $Apps) { If ((Get-AppxPackage -AllUsers -Name $Bloat) -or (Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat)) { - Write-Host "[-][UWP] Trying to remove $Bloat ..." Get-AppxPackage -AllUsers -Name $Bloat | Remove-AppxPackage # App Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -AllUsers # Payload - } Else { - Write-Warning "[?][UWP] $Bloat was already removed or not found." - } } -} +} \ No newline at end of file diff --git a/src/lib/show-message-box.psm1 b/src/lib/show-dialog-window.psm1 similarity index 93% rename from src/lib/show-message-box.psm1 rename to src/lib/show-dialog-window.psm1 index ee628bcd..d284ee39 100644 --- a/src/lib/show-message-box.psm1 +++ b/src/lib/show-dialog-window.psm1 @@ -2,15 +2,14 @@ function Use-WindowsForm() { [CmdletBinding()] param () - # Load assembly - [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null + [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null # Load assembly } function Show-Message() { [CmdletBinding()] param ( [String] $Title = "Insert title here", - [Array] $Message = "`nCrash`nBandicoot", + [Array] $Message = "`nCrash`nBandicoot", [String] $BoxButtons = "OK", # AbortRetryIgnore, OK, OKCancel, RetryCancel, YesNo, YesNoCancel [String] $BoxIcon = "Information" # Information, Question, Warning, Error or None ) @@ -23,7 +22,7 @@ function Show-Question() { [CmdletBinding()] param ( [String] $Title = "Insert title here", - [Array] $Message = "Crash`nBandicoot", + [Array] $Message = "Crash`nBandicoot", [String] $BoxButtons = "YesNoCancel", [String] $BoxIcon = "Question" ) diff --git a/src/lib/title-templates.psm1 b/src/lib/title-templates.psm1 index 29be7aa4..4fe333eb 100644 --- a/src/lib/title-templates.psm1 +++ b/src/lib/title-templates.psm1 @@ -1,10 +1,10 @@ function Write-Title() { [CmdletBinding()] param ( - [String] $Text = "Write-Title Text" + [String] $Text = "Write-Title Text" ) - Write-Host "`n<===================={ $Text }====================>`n" -ForegroundColor Cyan + Write-Host "`n<===================={ $Text }====================>" -ForegroundColor Cyan } function Write-Section() { @@ -22,13 +22,13 @@ function Write-Caption() { [String] $Text = "Write-Caption Text" ) - Write-Host "==> $Text`n" -ForegroundColor Cyan + Write-Host "`n==> $Text" -ForegroundColor Cyan } function Write-TitleCounter() { [CmdletBinding()] param ( - [String] $Text = "TitleCounter Text", + [String] $Text = "Write-TitleCounter Text", [Int] $MaxNum = $Global:MaxNum ) @@ -40,7 +40,7 @@ function Write-TitleCounter() { } $Global:Counter = $Counter + 1 - Write-Host "`n<===================={ ( $Counter/$MaxNum ) - { $Text } }====================>`n" -ForegroundColor Yellow + Write-Host "`n<===================={ ( $Counter/$MaxNum ) - { $Text } }====================>" -ForegroundColor Yellow # Reset both when the Counter is greater or equal than MaxNum and different from 0 If (($Counter -ge $MaxNum) -and !($Counter -eq 0)) { @@ -49,9 +49,8 @@ function Write-TitleCounter() { } } -function Write-ASCIIScriptName() { - [CmdletBinding()] - param () +function Write-ScriptLogo() { + [CmdletBinding()] param () Write-Host "<=========================================================================================================>`n" -ForegroundColor White Write-Host '888 888 d8b d888 .d8888b. .d8888b. 888 ' -ForegroundColor Green @@ -82,5 +81,5 @@ Write-Title -Text "Text" Write-Section -Text "Text" Write-Caption -Text "Text" Write-TitleCounter -Text "Text" -MaxNum 100 # First time only insert MaxNum -Write-ASCIIScriptName +Write-ScriptLogo #> \ No newline at end of file diff --git a/src/scripts/backup-system.ps1 b/src/scripts/backup-system.ps1 index 65c674f7..1635722c 100644 --- a/src/scripts/backup-system.ps1 +++ b/src/scripts/backup-system.ps1 @@ -6,7 +6,6 @@ function New-RestorePoint() { Write-Host "[+][Backup] Enabling system drive Restore Point..." Enable-ComputerRestore -Drive "$env:SystemDrive\" Checkpoint-Computer -Description "Win10SD Restore Point" -RestorePointType "MODIFY_SETTINGS" - } function Backup-HostsFile() { @@ -29,10 +28,8 @@ function Backup-HostsFile() { } function Main() { - New-RestorePoint # This makes a restoration point before the script begins Backup-HostsFile # Backup the Hosts file found on "X:\Windows\System32\drivers\etc" of the current system - } Main \ No newline at end of file diff --git a/src/scripts/install-drivers-updaters.ps1 b/src/scripts/install-drivers-updaters.ps1 index 2744e071..8c16d3db 100644 --- a/src/scripts/install-drivers-updaters.ps1 +++ b/src/scripts/install-drivers-updaters.ps1 @@ -1,57 +1,54 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"get-os-info.psm1" -Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-message-box.psm1" +Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1" Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1" function Install-DriverUpdater() { $CPU = Get-CPU # Detects the current CPU $GPU = Get-GPU # Detects the current GPU + + # Check for CPU drivers + If ($CPU.contains("AMD")) { + Write-Section -Text "Installing AMD $CPU chipset drivers updaters!" + Write-Warning "Search for $CPU chipset driver on the AMD website." + Write-Warning "This will only download an updater if AMD makes one." + } + ElseIf ($CPU.contains("Intel")) { + Write-Section -Text "Installing Intel $CPU chipset drivers updaters!" + Install-Software -Name "Intel® Driver & Support Assistant (Intel® DSA)" -Packages "Intel.IntelDriverAndSupportAssistant" # Intel® Driver & Support Assistant (Intel® DSA) + } + + # Check for GPU drivers then + If ($GPU.contains("AMD") -or $GPU.contains("Radeon")) { + Write-Title -Text "AMD $GPU GPU, you will have to install Manually!" + Write-Warning "Search for $GPU Graphics driver on the AMD website." + Write-Warning "This will only download an updater if AMD makes one." + } + + If ($GPU.contains("Intel")) { + Write-Section -Text "Intel $GPU Graphics driver updater already included!" + Install-Software -Name "Intel® Driver & Support Assistant (Intel® DSA)" -Packages "Intel.IntelDriverAndSupportAssistant" # Intel® Driver & Support Assistant (Intel® DSA) + } + + If ($GPU.contains("NVIDIA")) { + Write-Section -Text "NVIDIA $GPU Graphics driver updater!" + Install-Software -Name "NVIDIA GeForce Experience" -Packages "Nvidia.GeForceExperience" # NVIDIA GeForce Experience + } +} + +function Main() { $Ask = "Do you want to install CPU/GPU drivers?`nAll the following Driver Updaters will be installed (if found):`n- $CPU driver updater`n- $GPU driver updater" switch (Show-Question -Title "Warning" -Message $Ask) { 'Yes' { - # Check for CPU drivers - If ($CPU.contains("AMD")) { - Write-Section -Text "Installing AMD $CPU chipset drivers updaters!" - Write-Warning "Search for $CPU chipset driver on the AMD website." - Write-Warning "This will only download an updater if AMD makes one." - } - ElseIf ($CPU.contains("Intel")) { - Write-Section -Text "Installing Intel $CPU chipset drivers updaters!" - Write-Caption -Text "Installing: intel-dsa" - winget install --silent --source "winget" --id "Intel.IntelDriverAndSupportAssistant" | Out-Host # Intel® Driver & Support Assistant (Intel® DSA) - } - - # Check for GPU drivers then - If ($GPU.contains("AMD") -or $GPU.contains("Radeon")) { - Write-Title -Text "AMD $GPU GPU, you will have to install Manually!" - Write-Warning "Search for $GPU Graphics driver on the AMD website." - Write-Warning "This will only download an updater if AMD makes one." - } - - If ($GPU.contains("Intel")) { - Write-Section -Text "Intel $GPU Graphics driver updater already included!" - Write-Caption -Text "Installing: intel-dsa" - winget install --silent --source "winget" --id "Intel.IntelDriverAndSupportAssistant" | Out-Host # Intel® Driver & Support Assistant (Intel® DSA) - } - - If ($GPU.contains("NVIDIA")) { - Write-Section -Text "NVIDIA $GPU Graphics driver updater!" - Write-Caption -Text "Installing: Nvidia.GeForceExperience" - winget install --silent --source "winget" --id "Nvidia.GeForceExperience" | Out-Host # GeForce Experience (latest) - } + Install-DriverUpdater # Install CPU & GPU Drivers (If applicable) } 'No' { - Write-Host "You choose No. (No = Cancel)" + Write-Host "Aborting..." } 'Cancel' { - # With Yes, No and Cancel, the user can press Esc to exit - Write-Host "You choose Cancel. (Cancel = No)" + Write-Host "Aborting..." # With Yes, No and Cancel, the user can press Esc to exit } } } -function Main() { - Install-DriverUpdater # Install CPU & GPU Drivers (If applicable) -} - Main \ No newline at end of file diff --git a/src/scripts/install-gaming-dependencies.ps1 b/src/scripts/install-gaming-dependencies.ps1 index ace806e5..1f2de02e 100644 --- a/src/scripts/install-gaming-dependencies.ps1 +++ b/src/scripts/install-gaming-dependencies.ps1 @@ -1,61 +1,47 @@ -Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-message-box.psm1" +Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1" Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1" function Install-GamingSoftwareRequirement() { + $ChocoGamingPackages = @( + "directx" # DirectX End-User Runtime + ) + $WingetGamingPackages = @( + "Microsoft.dotNetFramework" # Microsoft .NET Framework (v4.8+) + "Microsoft.VC++2005Redist-x86" # Microsoft Visual C++ 2005 Redistributable + "Microsoft.VC++2005Redist-x64" # Microsoft Visual C++ 2005 Redistributable (x64) + "Microsoft.VC++2008Redist-x86" # Microsoft Visual C++ 2008 Redistributable - x86 + "Microsoft.VC++2008Redist-x64" # Microsoft Visual C++ 2008 Redistributable - x64 + "Microsoft.VC++2010Redist-x86" # Microsoft Visual C++ 2010 x86 Redistributable + "Microsoft.VC++2010Redist-x64" # Microsoft Visual C++ 2010 x64 Redistributable + "Microsoft.VC++2012Redist-x86" # Microsoft Visual C++ 2012 Redistributable (x86) + "Microsoft.VC++2012Redist-x64" # Microsoft Visual C++ 2012 Redistributable (x64) + "Microsoft.VC++2013Redist-x86" # Microsoft Visual C++ 2013 Redistributable (x86) + "Microsoft.VC++2013Redist-x64" # Microsoft Visual C++ 2013 Redistributable (x64) + "Microsoft.VC++2015-2022Redist-x86" # Microsoft Visual C++ 2015-2022 Redistributable (x86) + "Microsoft.VC++2015-2022Redist-x64" # Microsoft Visual C++ 2015-2022 Redistributable (x64) + ) + + Write-Title -Text "Installing Packages with Chocolatey" + Install-Software -Name "Gaming Dependencies (Chocolatey)" -Packages $ChocoGamingPackages -NoDialog -InstallBlock { choco install -y $Package } + + Write-Title -Text "Installing Packages with Winget" + Install-Software -Name "Gaming Dependencies (Winget)" -Packages $WingetGamingPackages +} +function Main() { $Ask = "Do you plan to play games on this PC?`nAll the following Gaming Dependencies will be installed:`n- Microsoft DirectX`n- Microsoft .NET Framework`n- Microsoft Visual C++ Packages (2005-2022)" switch (Show-Question -Title "Warning" -Message $Ask) { 'Yes' { - Write-Host "You choose Yes." - $ChocoGamingPackages = @( - "directx" # DirectX End-User Runtime - ) - - Write-Title -Text "Installing Packages with Chocolatey" - - ForEach ($Package in $ChocoGamingPackages) { - Write-TitleCounter -Text "Installing: $Package" -MaxNum $ChocoGamingPackages.Length - choco install -y $Package | Out-Host - } - - $WingetGamingPackages = @( - "Microsoft.dotNetFramework" # Microsoft .NET Framework (v4.8+) - "Microsoft.VC++2005Redist-x86" # Microsoft Visual C++ 2005 Redistributable - "Microsoft.VC++2005Redist-x64" # Microsoft Visual C++ 2005 Redistributable (x64) - "Microsoft.VC++2008Redist-x86" # Microsoft Visual C++ 2008 Redistributable - x86 - "Microsoft.VC++2008Redist-x64" # Microsoft Visual C++ 2008 Redistributable - x64 - "Microsoft.VC++2010Redist-x86" # Microsoft Visual C++ 2010 x86 Redistributable - "Microsoft.VC++2010Redist-x64" # Microsoft Visual C++ 2010 x64 Redistributable - "Microsoft.VC++2012Redist-x86" # Microsoft Visual C++ 2012 Redistributable (x86) - "Microsoft.VC++2012Redist-x64" # Microsoft Visual C++ 2012 Redistributable (x64) - "Microsoft.VC++2013Redist-x86" # Microsoft Visual C++ 2013 Redistributable (x86) - "Microsoft.VC++2013Redist-x64" # Microsoft Visual C++ 2013 Redistributable (x64) - "Microsoft.VC++2015-2022Redist-x86" # Microsoft Visual C++ 2015-2022 Redistributable (x86) - "Microsoft.VC++2015-2022Redist-x64" # Microsoft Visual C++ 2015-2022 Redistributable (x64) - ) - - Write-Title -Text "Installing Packages with Winget" - - ForEach ($Package in $WingetGamingPackages) { - Write-TitleCounter -Text "Installing: $Package" -MaxNum $WingetGamingPackages.Length - winget install --silent --source "winget" --id $Package | Out-Host - } + Install-GamingSoftwareRequirement # Install All Gaming Dependencies } 'No' { - Write-Host "You choose No. (No = Cancel)" + Write-Host "Aborting..." } 'Cancel' { - # With Yes, No and Cancel, the user can press Esc to exit - Write-Host "You choose Cancel. (Cancel = No)" + Write-Host "Aborting..." # With Yes, No and Cancel, the user can press Esc to exit } } } -function Main() { - - Install-GamingSoftwareRequirement # Install All Gaming Dependencies - -} - Main \ No newline at end of file diff --git a/src/scripts/install-package-managers.ps1 b/src/scripts/install-package-managers.ps1 index 33ad2ce3..99fe7998 100644 --- a/src/scripts/install-package-managers.ps1 +++ b/src/scripts/install-package-managers.ps1 @@ -54,7 +54,10 @@ function Install-PackageManager() { Write-Host "[@] ScheduledJob: $JobName FOUND!`n[@] Re-Creating with the command: '$("$UpdateScriptBlock".Trim(' '))'`n" -ForegroundColor White Unregister-ScheduledJob -Name $JobName } - Register-ScheduledJob @ScheduledJob | Out-Null + Else { + Write-Host "[@] Creating Scheduled Job with the command: '$("$UpdateScriptBlock".Trim(' '))'`n" -ForegroundColor White + Register-ScheduledJob @ScheduledJob | Out-Null + } } } diff --git a/src/scripts/personal-tweaks.ps1 b/src/scripts/personal-tweaks.ps1 index 1ce59991..2c41b961 100644 --- a/src/scripts/personal-tweaks.ps1 +++ b/src/scripts/personal-tweaks.ps1 @@ -1,3 +1,4 @@ +Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"file-runner.psm1" Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1" # Adapted from: https://github.com/ChrisTitusTech/win10script @@ -16,18 +17,10 @@ function Register-PersonalTweaksList() { $Global:PathToCUSearch = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" Write-Title -Text "My Personal Tweaks" - Push-Location -Path "$PSScriptRoot\..\utils\" - - Write-Host "[+][Personal] Enabling Dark theme..." - regedit /s use-dark-theme.reg - Write-Host "[-][Personal] Disabling Cortana..." - regedit /s disable-cortana.reg - Write-Host "[+][Personal] Enabling photo viewer..." - regedit /s enable-photo-viewer.reg - Write-Host "[-][Personal] Disabling clipboard history..." - regedit /s disable-clipboard-history.reg - - Pop-Location + + $Scripts = @("use-dark-theme.reg", "disable-cortana.reg", "enable-photo-viewer.reg", "disable-clipboard-history.reg") + Open-RegFilesCollection -RelativeLocation "src\utils" -Scripts $Scripts -DoneTitle "" -DoneMessage "" -NoDialog + Write-Section -Text "Windows Explorer Tweaks" Write-Host "[-][Personal] Hiding Quick Access from Windows Explorer..." diff --git a/src/scripts/remove-and-disable-xbox.ps1 b/src/scripts/remove-and-disable-xbox.ps1 index 44de3ae8..30601a1e 100644 --- a/src/scripts/remove-and-disable-xbox.ps1 +++ b/src/scripts/remove-and-disable-xbox.ps1 @@ -1,59 +1,59 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"remove-uwp-apps.psm1" -Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-message-box.psm1" +Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1" function Remove-Xbox() { [CmdletBinding()] param() $PathToLMPoliciesGameDVR = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" + + Write-Host "[-][Services] Disabling Xbox Services (Except from Accessories)..." + Get-Service -Name "XblAuthManager" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled + Get-Service -Name "XblGameSave" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled + Get-Service -Name "XboxNetApiSvc" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled + Stop-Service "XblAuthManager" -Force -NoWait + Stop-Service "XblGameSave" -Force -NoWait + Stop-Service "XboxNetApiSvc" -Force -NoWait + # Only disable if you'll not get ANY Xbox Accessory (Xbox Wireless Controller, Xbox Wireless Receiver, Steering Wheel, etc.) + #Get-Service -Name "XboxGipSvc" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled + #Stop-Service "XboxGipSvc" -Force -NoWait + + Write-Host "[-][UWP] Wiping Xbox completely from Windows..." + $XboxApps = @( + "Microsoft.XboxApp" # Xbox Console Companion (Replaced by new App) + "Microsoft.XboxGameCallableUI" + "Microsoft.XboxGameOverlay" + "Microsoft.XboxSpeechToTextOverlay" + "Microsoft.XboxGamingOverlay" # Xbox Game Bar + "Microsoft.XboxIdentityProvider" # Xbox Identity Provider (Xbox Dependency) + "Microsoft.Xbox.TCUI" # Xbox Live API communication (Xbox Dependency) + ) + + Remove-UWPAppsList -Apps $XboxApps + + Write-Host "[-][Priv&Perf] Disabling Xbox Game Bar & Game DVR..." + Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR" -Name "value" -Type DWord -Value 0 + Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Type DWord -Value 0 + Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 0 + If (!(Test-Path "$PathToLMPoliciesGameDVR")) { + New-Item -Path "$PathToLMPoliciesGameDVR" -Force | Out-Null + } + Set-ItemProperty -Path "$PathToLMPoliciesGameDVR" -Name "AllowGameDVR" -Type DWord -Value 0 +} + +function Main() { $Ask = "This will remove or disable the Xbox:`n - Apps;`n - Services (Except from Accessories) and;`n - GameBar;`n - GameDVR.`n`nDo you want to proceed?" switch (Show-Question -Title "Warning" -Message $Ask -BoxIcon "Warning") { 'Yes' { - Write-Host "[-][Services] Disabling Xbox Services (Except from Accessories)..." - Get-Service -Name "XblAuthManager" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled - Get-Service -Name "XblGameSave" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled - Get-Service -Name "XboxNetApiSvc" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled - Stop-Service "XblAuthManager" -Force -NoWait - Stop-Service "XblGameSave" -Force -NoWait - Stop-Service "XboxNetApiSvc" -Force -NoWait - # Only disable if you'll not get ANY Xbox Accessory (Xbox Wireless Controller, Xbox Wireless Receiver, Steering Wheel, etc.) - #Get-Service -Name "XboxGipSvc" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled - #Stop-Service "XboxGipSvc" -Force -NoWait - - Write-Host "[-][UWP] Wiping Xbox completely from Windows..." - $XboxApps = @( - "Microsoft.XboxApp" # Xbox Console Companion (Replaced by new App) - "Microsoft.XboxGameCallableUI" - "Microsoft.XboxGameOverlay" - "Microsoft.XboxSpeechToTextOverlay" - "Microsoft.XboxGamingOverlay" # Xbox Game Bar - "Microsoft.XboxIdentityProvider" # Xbox Identity Provider (Xbox Dependency) - "Microsoft.Xbox.TCUI" # Xbox Live API communication (Xbox Dependency) - ) - - Remove-UWPAppsList -Apps $XboxApps - - Write-Host "[-][Priv&Perf] Disabling Xbox Game Bar & Game DVR..." - Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR" -Name "value" -Type DWord -Value 0 - Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Type DWord -Value 0 - Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 0 - If (!(Test-Path "$PathToLMPoliciesGameDVR")) { - New-Item -Path "$PathToLMPoliciesGameDVR" -Force | Out-Null - } - Set-ItemProperty -Path "$PathToLMPoliciesGameDVR" -Name "AllowGameDVR" -Type DWord -Value 0 + Remove-Xbox # Remove all Xbox related Apps, services, etc. } 'No' { - Write-Host "You choose No. (No = Cancel)" + Write-Host "Aborting..." } 'Cancel' { - # With Yes, No and Cancel, the user can press Esc to exit - Write-Host "You choose Cancel. (Cancel = No)" + Write-Host "Aborting..." # With Yes, No and Cancel, the user can press Esc to exit } } } -function Main() { - Remove-Xbox # Remove all Xbox related Apps, services, etc. -} - Main \ No newline at end of file diff --git a/src/scripts/remove-bloatware-apps.ps1 b/src/scripts/remove-bloatware-apps.ps1 index 3f1ab34e..a12fca54 100644 --- a/src/scripts/remove-bloatware-apps.ps1 +++ b/src/scripts/remove-bloatware-apps.ps1 @@ -49,7 +49,7 @@ function Remove-BloatwareAppsList() { "Microsoft.XboxGameOverlay" "Microsoft.XboxSpeechToTextOverlay" "Microsoft.YourPhone" # Your Phone - "Microsoft.ZuneMusic" # Groove Music / + "Microsoft.ZuneMusic" # Groove Music / (New) Windows Media Player "Microsoft.ZuneVideo" # Movies & TV # Default Windows 11 apps diff --git a/src/utils/git-gnupg-ssh-keys-setup.ps1 b/src/utils/git-gnupg-ssh-keys-setup.ps1 index c651af94..a7e626ff 100644 --- a/src/utils/git-gnupg-ssh-keys-setup.ps1 +++ b/src/utils/git-gnupg-ssh-keys-setup.ps1 @@ -1,4 +1,5 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"install-software.psm1" +Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1" function Request-AdminPrivilege() { # Used from https://stackoverflow.com/a/31602095 because it preserves the working directory! @@ -184,16 +185,24 @@ function Set-GPGKey() { } function Main() { + $Ask = "Before everything, your data will only be keep locally, only in YOUR PC.`nI've made this to be more productive and not to lose time setting signing keys on Windows.`nIf you already have your keys located at ~/.ssh and ~/.gnupg,`nthey'll be imported after a new key generation/setup on git.`n`nDo you want to proceed?" + Request-AdminPrivilege - Install-Software -Name "Git and GnuPG" -PackageName @("Git.Git", "GnuPG.GnuPG") -NoDialog - - Write-Host "Before everything, your data will only be keep locally, only in YOUR PC." -ForegroundColor Cyan - Write-Host "I've made this to be more productive and not to lose time setting signing keys on Windows." -ForegroundColor Cyan - Write-Host "If you already have your keys located at ~/.ssh and ~/.gnupg,`nthey'll be imported after a new key generation/setup on git." -ForegroundColor Cyan - Read-Host "Press Enter to continue...`n" - Set-GitProfile - Set-SSHKey - Set-GPGKey + Install-Software -Name "Git + GnuPG" -Packages @("Git.Git", "GnuPG.GnuPG") -NoDialog + + switch (Show-Question -Title "Warning" -Message $Ask -BoxIcon "Warning") { + 'Yes' { + Set-GitProfile + Set-SSHKey + Set-GPGKey + } + 'No' { + Write-Host "Aborting..." + } + 'Cancel' { + Write-Host "Aborting..." # With Yes, No and Cancel, the user can press Esc to exit + } + } } Main \ No newline at end of file