Created
July 24, 2020 20:38
-
-
Save chadbaldwin/026318b78ac26199211267e5a3efebfa 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
# Dark Theme | |
$file = gi "${env:ProgramFiles(x86)}\Microsoft SQL Server Management Studio 18\Common7\IDE\ssms.pkgundef"; ($file | gc) -Replace '(.*{1ded0138-47ce-435e-84ef-9ec1f439b749})', '//$1' | Out-File $file; | |
# Query execution settings | |
$ssmsUserSettingsFile = "$($env:APPDATA)\Microsoft\SQL Server Management Studio\18.0\UserSettings.xml"; | |
$newXml = "<Element><Key><int>-1</int></Key><Value><string /></Value></Element> | |
<Element><Key><int>3</int></Key><Value><string /></Value></Element> | |
<Element><Key><int>4</int></Key><Value><string /></Value></Element> | |
<Element><Key><int>5</int></Key><Value><string>USE </string></Value></Element> | |
<Element><Key><int>6</int></Key><Value><string>SELECT FORMAT(COUNT(*),'N0') FROM </string></Value></Element> | |
<Element><Key><int>7</int></Key><Value><string>SELECT TOP(100) * FROM </string></Value></Element> | |
<Element><Key><int>8</int></Key><Value><string>SELECT * FROM </string></Value></Element> | |
<Element><Key><int>9</int></Key><Value><string>SELECT </string></Value></Element> | |
<Element><Key><int>0</int></Key><Value><string /></Value></Element>" | |
# Open file | |
[xml]$xmlDoc = gc $ssmsUserSettingsFile; $QESettings=$xmlDoc.SqlStudio.SSMS.QueryExecution; | |
# Set Settings | |
($QESettings.SelectSingleNode("QueryShortcuts")).InnerXml=$newXml; | |
$QESettings.ExecutionSettings.SetTransactionIsolationLevel="READ UNCOMMITTED"; | |
$QESettings.ExecutionSettings.SetDeadlockPriorityLow="true"; | |
$QESettings.ExecutionResults.RetainCRLFOnCopyOrSave="true"; | |
# Save file, then re-open and save to format | |
$xmlDoc.Save($ssmsUserSettingsFile); [xml]$xmlDoc = gc $ssmsUserSettingsFile; $xmlDoc.Save($ssmsUserSettingsFile); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[reserving first comment]