Auto-disable your iGPUs automagically using a PowerShell script!

Figured out your backlight issue. Solution is to ensure external monitor is only output before killing Igpu, since Igpu is running internal monitor and we are disabling without first stopping display, some fuckery is happening. Added a switch display to external and 5 second wait before stopping IGPU.

I am having an issue with internal display not turning back on when unpluging, no combination of waiting, or forcing internal display helps, but for now I can turn off laptop, then unplug EGPU, when I turn back on all is good.

Register-WmiEvent -Class Win32\DeviceChangeEvent -SourceIdentifier graphicsCardChanged)
do{
$newEvent = Wait-Event -SourceIdentifier graphicsCardChanged
$eventType = $newEvent.SourceEventArgs.NewEvent.EventType
$eventTypeName = switch($eventType)
{
1 {"Configuration changed"}
2 {"Device arrival"}
3 {"Device removal"}
4 {"docking"}
}
$condition1 = (Get-PnpDevice | where {($\.friendlyname) -like "<eGPU name>" -and ($_.status) -like "Ok"}) -ne $null)
$condition2 = (Get-PnpDevice | where {($\.friendlyname) -like "<eGPU name>" -and ($_.status) -like "Unknown"}) -ne $null)
if ($eventType -eq 2 -and $condition1 {)
displayswitch.exe /external
Start-Sleep -s 5
Get-PnpDevice| where {$\.friendlyname -like "Intel(R) Iris(R) Xe Graphics"} | Disable-PnpDevice -Confirm:$false)
}
if ($eventType -eq 3 -and $condition2 {)
Get-PnpDevice| where {$\.friendlyname -like "Intel(R) Iris(R) Xe Graphics"} | Enable-PnpDevice -Confirm:$false)
}
Remove-Event -SourceIdentifier graphicsCardChanged
} while (1-eq1 #Loop until next event)
Unregister-Event -SourceIdentifier graphicsCardChanged

/r/eGPU Thread