commit 796842ff1ed2d2094c47e549d215349951e95640 Author: ondra Date: Fri Nov 1 11:12:49 2024 +0100 working on my laptop with 1650 maxq 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." +