From 91087b7c766a6094c417f4026e4b715f6d4d1015 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 16 Jul 2023 23:07:49 +0200 Subject: [PATCH] Add script for installing GPU-Z --- scripts/Windows/Collections/Personal.ps1 | 4 +++ scripts/Windows/Software/GPU-Z/Install.ps1 | 32 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 scripts/Windows/Software/GPU-Z/Install.ps1 diff --git a/scripts/Windows/Collections/Personal.ps1 b/scripts/Windows/Collections/Personal.ps1 index 31bb0ef15..f94fb01c4 100644 --- a/scripts/Windows/Collections/Personal.ps1 +++ b/scripts/Windows/Collections/Personal.ps1 @@ -27,6 +27,8 @@ function Backup-PersonalApps([Context] $context) { } function Restore-PersonalApps([Context] $context) { + $softwareDir = "$PSScriptRoot/../Software"; + # Backed up applications Restore-Git $context; Restore-LogitechGHUB $context; @@ -52,6 +54,8 @@ function Restore-PersonalApps([Context] $context) { keepass ` gimp; + . "$softwareDir/GPU-Z/Install.ps1"; + # Media choco install -y k-litecodecpackmega; diff --git a/scripts/Windows/Software/GPU-Z/Install.ps1 b/scripts/Windows/Software/GPU-Z/Install.ps1 new file mode 100644 index 000000000..f2cc60bc6 --- /dev/null +++ b/scripts/Windows/Software/GPU-Z/Install.ps1 @@ -0,0 +1,32 @@ +#!/bin/pwsh +param($context) +. "$PSScriptRoot/../../Scripts/Context.ps1"; +. "$PSScriptRoot/../../Scripts/BrowserAutomation.ps1"; +. "$PSScriptRoot/../../Scripts/SoftwarePackage.ps1"; + +Write-Host "Installing GPU-Z"; +$tempDir = $context.GetTempDirectory(); +$versionSelector = ".versions .version:first-of-type .file"; +$versionButtonSelector = "${versionSelector}.selected input.startbutton"; +$downloadButtonSelector = 'button[type="submit"]:first-of-type'; + +$action = { + param([OpenQA.Selenium.Firefox.FirefoxDriver] $browser) + $versions = $browser.FindElements([OpenQA.Selenium.By]::CssSelector($versionSelector)); + + $version = ($versions | Where-Object { $_.Text.ToUpper().Contains("ASUS ROG"); })[0]; + $version.Click(); + + $versionButton = $browser.FindElement([OpenQA.Selenium.By]::CssSelector($versionButtonSelector)); + $versionButton.Click(); + + $downloadButton = $browser.FindElement([OpenQA.Selenium.By]::CssSelector($downloadButtonSelector)); + $downloadButton.Click(); +} + +Write-Information "Downloading GPU-Z"; +$file = Start-CustomDownload $context "https://www.techpowerup.com/download/techpowerup-gpu-z/" $action $tempDir; +Write-Information "Launching GPU-Z installer"; +Start-Process -Wait -FilePath $file.FullName -ArgumentList "-installSilent"; + +Remove-Item -Recurse $tempDir;