Skip to content

Instantly share code, notes, and snippets.

@sob
Created December 9, 2019 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sob/810470f3d1284452ea8bfc7caf343feb to your computer and use it in GitHub Desktop.
Save sob/810470f3d1284452ea8bfc7caf343feb to your computer and use it in GitHub Desktop.
#
# Fixes the SUrface Book 2 Intel Video adataper after dock / undock with Microsoft Surface Dock
# NOTE: same issue appeared on my original Surface Book but this is untested there.
#
# get the id and security principal of the current user
$myWindowsId = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the administrator role
$adminRole = [System.Security.Principal.WIndowsBuiltInRole]::administrator
if ($myWindowsPrincipal.IsInRole($adminRole))
{
# We are running "as Administrator" - so change the title and background color
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
$Host.UI.RawUI.BackgroundColor = "DarkRed"
clear-host
}
else
{
# We are not running "as Administrator" - so relaunch as administrator
$newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell";
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
$newProcess.Verb = "runas"
# Start the new process
[System.Diagnostics.Process]::Start($newProcess);
exit
}
Get-PnpDevice -FriendlyName "Intel(R) UHD Graphics 620" | Disable-PnpDevice -confirm:$false
Get-PnpDevice -FriendlyName "Intel(R) UHD Graphics 620" | Enable-PnpDevice -confirm:$false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment