Skip to content

Instantly share code, notes, and snippets.

@NickCraver
Last active June 24, 2023 23:30
Show Gist options
  • Save NickCraver/c30e4f701d01f1ca90672c4e625253be to your computer and use it in GitHub Desktop.
Save NickCraver/c30e4f701d01f1ca90672c4e625253be to your computer and use it in GitHub Desktop.
PowerShell: SSMS 16 & 17 HiDPI Enable
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"><asmv3:application><asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"><dpiAware>True</dpiAware></asmv3:windowsSettings></asmv3:application><dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /></dependentAssembly></dependency><dependency><dependentAssembly><assemblyIdentity type="win32" name="debuggerproxy.dll" processorArchitecture="X86" version="1.0.0.0"></assemblyIdentity></dependentAssembly></dependency></assembly>';
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide" -Name PreferExternalManifest -Value 1 -Type DWord;
$ssms16 = "C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Ssms.exe";
if ((Test-Path $ssms16)) { $xml | Out-File -FilePath "$ssms16.manifest" -Encoding UTF8; }
$ssms17 = "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe";
if ((Test-Path $ssms17)) { $xml | Out-File -FilePath "$ssms17.manifest" -Encoding UTF8; }
@johnmwright
Copy link

Does the PreferExternalManifest Registry setting open an attack surface, since it appears to apply to all executables?

Also, you might consider saving off a copy of the old manifest file before overwriting it -- just in case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment