20 lines
935 B
PowerShell
20 lines
935 B
PowerShell
# 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."
|
|
|