From 796842ff1ed2d2094c47e549d215349951e95640 Mon Sep 17 00:00:00 2001 From: ondra Date: Fri, 1 Nov 2024 11:12:49 +0100 Subject: [PATCH] working on my laptop with 1650 maxq --- disableGPU.ps1 | 19 +++++++++++++++++++ enableGPU.ps1 | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 disableGPU.ps1 create mode 100644 enableGPU.ps1 diff --git a/disableGPU.ps1 b/disableGPU.ps1 new file mode 100644 index 0000000..132373e --- /dev/null +++ b/disableGPU.ps1 @@ -0,0 +1,19 @@ +# Function to check if the script is running as Administrator +function Test-Administrator { + $currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) + $currentUser.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) +} + +# Relaunch the script with elevated privileges if not running as Administrator +if (-not (Test-Administrator)) { + Write-Host "This script needs to be run as Administrator. Relaunching with elevated privileges..." + Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs + Exit +} + +# Disable the NVIDIA GeForce GTX 1650 with Max-Q Design without confirmation +Get-PnpDevice -FriendlyName "*NVIDIA GeForce GTX 1650 with Max-Q Design*" | Disable-PnpDevice -Confirm:$false + +# Output success message +Write-Host "The NVIDIA GeForce GTX 1650 with Max-Q Design has been disabled." + diff --git a/enableGPU.ps1 b/enableGPU.ps1 new file mode 100644 index 0000000..4055bad --- /dev/null +++ b/enableGPU.ps1 @@ -0,0 +1,19 @@ +# Function to check if the script is running as Administrator +function Test-Administrator { + $currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) + $currentUser.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) +} + +# Relaunch the script with elevated privileges if not running as Administrator +if (-not (Test-Administrator)) { + Write-Host "This script needs to be run as Administrator. Relaunching with elevated privileges..." + Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs + Exit +} + +# Disable the NVIDIA GeForce GTX 1650 with Max-Q Design without confirmation +Get-PnpDevice -FriendlyName "*NVIDIA GeForce GTX 1650 with Max-Q Design*" | Enable-PnpDevice -Confirm:$false + +# Output success message +Write-Host "The NVIDIA GeForce GTX 1650 with Max-Q Design has been disabled." +