Created
December 9, 2019 20:40
-
-
Save sob/810470f3d1284452ea8bfc7caf343feb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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