Skip to content

Instantly share code, notes, and snippets.

@shaansubbaiah
Created September 7, 2022 06:12
Show Gist options
  • Save shaansubbaiah/d968e2d995d76608b005e8a1b3bf1aed to your computer and use it in GitHub Desktop.
Save shaansubbaiah/d968e2d995d76608b005e8a1b3bf1aed to your computer and use it in GitHub Desktop.
Toggle ClearType in Remote Desktop
# From https://stackoverflow.com/a/14004451
$signature = @'
[DllImport("user32.dll")]
public static extern bool SystemParametersInfo(
uint uiAction,
uint uiParam,
uint pvParam,
uint fWinIni);
'@
$SPI_SETFONTSMOOTHING = 0x004B
$SPI_SETFONTSMOOTHINGTYPE = 0x200B
$SPIF_UPDATEINIFILE = 0x1
$SPIF_SENDCHANGE = 0x2
$FE_FONTSMOOTHINGCLEARTYPE = 0x2
$winapi = Add-Type -MemberDefinition $signature -Name WinAPI -PassThru
[void]$winapi::SystemParametersInfo($SPI_SETFONTSMOOTHING, 1, 0, $SPIF_UPDATEINIFILE -bor $SPIF_SENDCHANGE)
[void]$winapi::SystemParametersInfo($SPI_SETFONTSMOOTHINGTYPE, 0, $FE_FONTSMOOTHINGCLEARTYPE, $SPIF_UPDATEINIFILE -bor $SPIF_SENDCHANGE)
# Restart Windows Explorer
taskkill /f /im explorer.exe
start explorer.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment