-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
550 lines (520 loc) · 37 KB
/
index.html
File metadata and controls
550 lines (520 loc) · 37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>SqlServer Version Management Module</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Theme Styles -->
<style>
:root {
color-scheme: light dark;
--bg: #ffffff;
--text: #000000;
--code-bg: #f6f8fa;
--button-bg: #e1e4e8;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #0d1117;
--text: #c9d1d9;
--code-bg: #161b22;
--button-bg: #30363d;
}
}
body {
background: var(--bg);
color: var(--text);
font-family: system-ui, sans-serif;
max-width: 800px;
margin: auto;
padding: 2rem;
line-height: 1.6;
}
pre {
background: var(--code-bg);
padding: 1em;
overflow-x: auto;
border-radius: 6px;
position: relative;
}
h1, h2, h3 {
border-bottom: 1px solid #ccc;
padding-bottom: 0.3em;
}
a {
color: #1e88e5;
}
/* Copy Button */
.copy-btn {
position: absolute;
top: 0.5em;
right: 0.5em;
background: var(--button-bg);
border: none;
padding: 0.4em;
border-radius: 6px;
cursor: pointer;
font-size: 0.9em;
opacity: 0.7;
display: flex;
align-items: center;
justify-content: center;
}
.copy-btn:hover {
opacity: 1;
}
.copy-btn svg {
width: 1em;
height: 1em;
fill: var(--text);
}
</style>
<!-- Highlight.js GitHub Theme -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css" media="(prefers-color-scheme: dark)">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
<style>
.hljs { background: #f6f8fa }
body { max-width: 1200px }
@media (prefers-color-scheme: dark) {
.hljs { background: #161b22 }
}
</style>
<!-- link rel="stylesheet" href="tables.css" -->
<style>
/* Modern TABLES */
table {
width: 100%;
border-collapse: collapse;
margin: 1.5em 0;
font-size: 0.95em;
border: 1px solid #d0d7de;
}
thead {
background-color: #f6f8fa;
}
@media (prefers-color-scheme: dark) {
thead {
background-color: #161b22;
}
}
th, td {
border: 1px solid #d0d7de;
padding: 0.75em 1em;
text-align: left;
}
th {
font-weight: 600;
}
tr:nth-child(even) {
background-color: rgba(0, 0, 0, 0.03);
}
@media (prefers-color-scheme: dark) {
tr:nth-child(even) {
background-color: rgba(255, 255, 255, 0.05);
}
table, th, td {
border-color: #30363d;
}
}
</style>
<!-- anchors css -->
<style>
.header-anchor {
margin-left: 0.5em;
text-decoration: none;
color: var(--muted-text);
opacity: 0.3;
font-size: 0.7em;
padding-bottom: 10px;
font-weight: 100;
font-variant-emoji: text;
}
.header-anchor:hover {
opacity: 1;
text-decoration: none;
}
</style>
</head>
<body>
<h2
id="sqlserver-version-management-powershell-module">SqlServer-Version-Management
Powershell Module</h2>
<p>SQL Server Setup and Management including Developer, Express, and
LocalDB editions. The intended use of this project is for Continuous
Integration (CI) scenarios, where:</p>
<ul>
<li>SQL Server or LocalDB needs to be installed without user
interaction.</li>
<li>SQL Server or LocalDB installation doesn’t need to persist across
multiple CI runs.</li>
</ul>
<p>SQL Server Setup defaults:</p>
<ul>
<li>Features are SQL Engine and full text search,</li>
<li>Built-in Administrators (or localized name) are SQL Server
Administrators for SSPI,</li>
<li>TCP/IP and Named Pipe protocols are on,</li>
<li>sa password is ‘Meaga$tr0ng’.</li>
</ul>
<h2 id="supported-sql-server-version-arguments">Supported SQL Server
version arguments:</h2>
<p>✔ <em>2025 Developer</em> 🡒 17.0.1000.7 Enterprise Developer
Edition (64-bit) RTM<br/> ✔ <em>2025 Core</em> 🡒 17.0.1000.7 Express
Edition (64-bit) RTM<br/> ✔ <em>2025 LocalDB</em> 🡒 17.0.1000.7
LocalDB Express Edition (64-bit) RTM<br/> ✔ <em>2022 Developer
Update</em> 🡒 16.0.4135.4 RTM CU14 Developer Edition (64-bit)<br/> ✔
<em>2022 Developer</em> 🡒 16.0.1000.6 RTM Developer Edition
(64-bit)<br/> ✔ <em>2022 Advanced Update</em> 🡒 16.0.4135.4 RTM CU14
Express Edition (64-bit)<br/> ✔ <em>2022 Advanced</em> 🡒 16.0.1000.6
RTM Express Edition (64-bit)<br/> ✔ <em>2022 Core Update</em> 🡒
16.0.4135.4 RTM CU14 Express Edition (64-bit)<br/> ✔ <em>2022
Core</em> 🡒 16.0.1000.6 RTM Express Edition (64-bit)<br/> ✔ <em>2022
LocalDB</em> 🡒 16.0.1000.6 RTM LocalDB Express Edition (64-bit)<br/> ✔
<em>2019 Developer Update</em> 🡒 15.0.4385.2 RTM CU28 Developer Edition
(64-bit)<br/> ✔ <em>2019 Developer</em> 🡒 15.0.2000.5 RTM Developer
Edition (64-bit)<br/> ✔ <em>2019 Advanced Update</em> 🡒 15.0.4385.2
RTM CU28 Express Edition (64-bit)<br/> ✔ <em>2019 Advanced</em> 🡒
15.0.2000.5 RTM Express Edition (64-bit)<br/> ✔ <em>2019 Core
Update</em> 🡒 15.0.4385.2 RTM CU28 Express Edition (64-bit)<br/> ✔
<em>2019 Core</em> 🡒 15.0.2000.5 RTM Express Edition (64-bit)<br/> ✔
<em>2019 LocalDB</em> 🡒 15.0.2000.5 RTM LocalDB Express Edition
(64-bit)<br/> ✔ <em>2017 Developer Update</em> 🡒 14.0.3456.2 RTM CU31
Developer Edition (64-bit)<br/> ✔ <em>2017 Developer</em> 🡒
14.0.1000.169 RTM Developer Edition (64-bit)<br/> ✔ <em>2017 Advanced
Update</em> 🡒 14.0.3456.2 RTM CU31 Express Edition (64-bit)<br/> ✔
<em>2017 Advanced</em> 🡒 14.0.1000.169 RTM Express Edition (64-bit)<br/>
✔ <em>2017 Core Update</em> 🡒 14.0.3456.2 RTM CU31 Express Edition
(64-bit)<br/> ✔ <em>2017 Core</em> 🡒 14.0.1000.169 RTM Express Edition
(64-bit)<br/> ✔ <em>2017 LocalDB</em> 🡒 14.0.1000.169 RTM LocalDB
Express Edition (64-bit)<br/> ✔ <em>2016 Developer Update</em> 🡒
13.0.6441.1 SP3 Developer Edition (64-bit)<br/> ✔ <em>2016
Developer</em> 🡒 13.0.6404.1 SP3 Developer Edition (64-bit)<br/> ✔
<em>2016 Advanced Update</em> 🡒 13.0.6441.1 SP3 Express Edition
(64-bit)<br/> ✔ <em>2016 Advanced</em> 🡒 13.0.6404.1 SP3 Express
Edition (64-bit)<br/> ✔ <em>2016 Core Update</em> 🡒 13.0.6441.1 SP3
Express Edition (64-bit)<br/> ✔ <em>2016 Core</em> 🡒 13.0.6404.1 SP3
Express Edition (64-bit)<br/> ✔ <em>2016 LocalDB</em> 🡒 13.0.6300.2
SP3 LocalDB Express Edition (64-bit)<br/> ✔ <em>2014-x64
Developer</em> 🡒 12.0.6024.0 SP3 Developer Edition (64-bit)<br/> ✔
<em>2014-x64 Advanced</em> 🡒 12.0.6024.0 SP3 Express Edition
(64-bit)<br/> ✔ <em>2014-x64 Core</em> 🡒 12.0.6024.0 SP3 Express
Edition (64-bit)<br/> ✔ <em>2014-x64 LocalDB</em> 🡒 12.0.6024.0 SP3
LocalDB Express Edition (64-bit)<br/> ✔ <em>2014-x86 Developer</em> 🡒
12.0.6024.0 SP3 Developer Edition<br/> ✔ <em>2014-x86 Advanced</em> 🡒
12.0.6024.0 SP3 Express Edition<br/> ✔ <em>2014-x86 Core</em> 🡒
12.0.6024.0 SP3 Express Edition<br/> ✔ <em>2012-x64 Developer</em> 🡒
11.0.7001.0 SP4 Developer Edition (64-bit)<br/> ✔ <em>2012-x64
Advanced</em> 🡒 11.0.7001.0 SP4 Express Edition (64-bit)<br/> ✔
<em>2012-x64 Core</em> 🡒 11.0.7001.0 SP4 Express Edition (64-bit)<br/>
✔ <em>2012-x64 LocalDB</em> 🡒 11.0.7001.0 SP4 LocalDB Express Edition
(64-bit)<br/> ✔ <em>2012-x86 Developer</em> 🡒 11.0.7001.0 SP4
Developer Edition<br/> ✔ <em>2012-x86 Advanced</em> 🡒 11.0.7001.0 SP4
Express Edition<br/> ✔ <em>2012-x86 Core</em> 🡒 11.0.7001.0 SP4
Express Edition<br/> ✔ <em>2008R2-x64 Developer</em> 🡒 10.50.6000.34
SP3 Developer Edition (64-bit)<br/> ✔ <em>2008R2-x64 Advanced
Update</em> 🡒 10.50.6000.34 SP3 Express Edition with Advanced Services
(64-bit)<br/> ✔ <em>2008R2-x64 Advanced</em> 🡒 10.50.4000.0 SP2
Express Edition with Advanced Services (64-bit)<br/> ✔ <em>2008R2-x64
Core Update</em> 🡒 10.50.6000.34 SP3 Express Edition (64-bit)<br/> ✔
<em>2008R2-x64 Core</em> 🡒 10.50.4000.0 SP2 Express Edition
(64-bit)<br/> ✔ <em>2008R2-x86 Developer</em> 🡒 10.50.6000.34 SP3
Developer Edition<br/> ✔ <em>2008R2-x86 Advanced Update</em> 🡒
10.50.6000.34 SP3 Express Edition with Advanced Services<br/> ✔
<em>2008R2-x86 Advanced</em> 🡒 10.50.4000.0 SP2 Express Edition with
Advanced Services<br/> ✔ <em>2008R2-x86 Core Update</em> 🡒
10.50.6000.34 SP3 Express Edition<br/> ✔ <em>2008R2-x86 Core</em> 🡒
10.50.4000.0 SP2 Express Edition<br/> ✔ <em>2008-x64 Advanced
Update</em> 🡒 10.0.6000.29 SP4 Express Edition with Advanced Services
(64-bit)<br/> ✔ <em>2008-x64 Advanced</em> 🡒 10.0.1600.22 RTM Express
Edition with Advanced Services (64-bit)<br/> ✔ <em>2008-x64 Core
Update</em> 🡒 10.0.6000.29 SP4 Express Edition (64-bit)<br/> ✔
<em>2008-x64 Core</em> 🡒 10.0.5500.0 SP3 Express Edition (64-bit)<br/>
✔ <em>2008-x86 Advanced Update</em> 🡒 10.0.6000.29 SP4 Express Edition
with Advanced Services<br/> ✔ <em>2008-x86 Advanced</em> 🡒
10.0.1600.22 RTM Express Edition with Advanced Services<br/> ✔
<em>2008-x86 Core Update</em> 🡒 10.0.6000.29 SP4 Express Edition<br/>
✔ <em>2008-x86 Core</em> 🡒 10.0.5500.0 SP3 Express Edition<br/> ✔
<em>2005-x86 Advanced Update</em> 🡒 9.00.5000.00 SP4 Express Edition
with Advanced Services<br/> ✔ <em>2005-x86 Advanced</em> 🡒
9.00.3042.00 SP2 Express Edition with Advanced Services<br/> ✔
<em>2005-x86 Core</em> 🡒 9.00.5000.00 SP4 Express Edition<br/></p>
<h2 id="setup-sqlservers-function">Setup-SqlServers function</h2>
<p>🌟 Install SQL Server 2022 Developer Edition with Cumulative Update
as default instance (local) with UTF8 Collation:</p>
<div class="sourceCode" id="cb1"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>Setup-SqlServers <span class="st">"2022 Developer Updated: MSSQLSERVER"</span> `</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> <span class="st">"Collation=Latin1_General_100_CI_AS_SC_UTF8"</span></span></code></pre></div>
<p><br/></p>
<p>🌟 Install four SQL Server Instances and their <code>tempdb</code> on
system drive, and place the data and log folders on the secondary
SSD:</p>
<div class="sourceCode" id="cb2"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="va">$sqlServers</span><span class="op">=</span><span class="vs">@"</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="vs">2022 Developer Updated: DEVELOPER2022,</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="vs">2019 Developer Updated: DEVELOPER2019,</span></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="vs">2017 Developer Updated: DEVELOPER2017,</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="vs">2016 Developer Updated: DEVELOPER2016</span></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="vs">"@</span><span class="op">;</span></span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a>Setup-SqlServers <span class="va">$sqlServers</span> `</span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"/SQLUSERDBDIR=D:\SQL\{InstanceName}-DATA"</span> `</span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"/SQLUSERDBLOGDIR=D:\SQL\{InstanceName}-LOGS"</span></span></code></pre></div>
<p><br/></p>
<p>🌟 Install SQL Server 2019 Developer Edition RTM as DEVELOPER2019
instance:</p>
<div class="sourceCode" id="cb3"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>Setup-SqlServers <span class="st">"2019 Developer: DEVELOPER2019"</span></span></code></pre></div>
<p><br/></p>
<p>🌟 Install SQL Server 2016 Developer Edition SP3 as DEVELOPER2016
instance tuned for performance:</p>
<div class="sourceCode" id="cb4"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="va">$ENV</span><span class="op">:</span><span class="va">PS1_TROUBLE_SHOOT</span> <span class="op">=</span> <span class="st">"On"</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="va">$ENV</span><span class="op">:</span><span class="va">SQLSERVERS_MEDIA_FOLDER</span> <span class="op">=</span> <span class="st">"D:\SQL-SETUP\Media"</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="va">$ENV</span><span class="op">:</span><span class="va">SQLSERVERS_SETUP_FOLDER</span> <span class="op">=</span> <span class="st">"C:\SQL-SETUP\Installer"</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a>Setup-SqlServers <span class="st">"2016 Developer: DEVELOPER2016"</span> `</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="st">"Features=SQLENGINE,FullText"</span> `</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="st">"Collation=SQL_Latin1_General_CP1_CI_AS"</span> `</span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="st">"Startup=Automatic"</span> `</span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"InstallTo=D:\SQL"</span> `</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"Password=Zuper</span><span class="ch">`$</span><span class="st">tr0ng"</span> </span></code></pre></div>
<p><br/></p>
<p>🌟 List Installed SQL Server Intances</p>
<div class="sourceCode" id="cb5"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>Find-Local-SqlServers <span class="op">|</span> </span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">Format-Table</span> <span class="op">-</span>AutoSize <span class="op">|</span> </span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-String</span> <span class="op">-</span>Width <span class="dv">1234</span> <span class="op">|</span> </span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-Host</span></span></code></pre></div>
<pre><code>Instance InstallerVersion Service
-------- ---------------- -------
(local) 16.0.1000.6 MSSQLSERVER
(local)\ADV_2005_X86 9.00.5000.00 MSSQL$ADV_2005_X86
(local)\ADV_2008R2_X64 10.50.6000.34 MSSQL$ADV_2008R2_X64
(local)\ADV_2008_X86 10.0.1600.22 MSSQL$ADV_2008_X86
(local)\DEV2022UTF8 16.0.1000.6 MSSQL$DEV2022UTF8
(local)\DEV_2008R2_X64 10.50.6000.34 MSSQL$DEV_2008R2_X64
(local)\DEV_2008_X64 10.0.6000.29 MSSQL$DEV_2008_X64
(local)\DEV_2012_X64 11.0.7001.0 MSSQL$DEV_2012_X64
(local)\DEV_2014_X64 12.0.6024.0 MSSQL$DEV_2014_X64
(local)\DEV_2016 13.0.6441.1 MSSQL$DEV_2016
(local)\DEV_2017 14.0.1000.169 MSSQL$DEV_2017
(local)\DEV_2019 15.0.2000.5 MSSQL$DEV_2019</code></pre>
<p><br/></p>
<p>🌟 List Installed SQL Server Services, wait up to 30 seconds for each
SQL Server health check to pass, and populate Version column</p>
<div class="sourceCode" id="cb7"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>Find-Local-SqlServers <span class="op">|</span> </span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> Populate-Local-SqlServer-Version <span class="op">-</span>Timeout <span class="dv">30</span> <span class="op">|</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">Format-Table</span> <span class="op">-</span>AutoSize <span class="op">|</span> </span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-String</span> <span class="op">-</span>Width <span class="dv">1234</span> <span class="op">|</span> </span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-Host</span></span></code></pre></div>
<pre><code>Instance InstallerVersion Service Version
-------- ---------------- ------- -------
(local) 16.0.1000.6 MSSQLSERVER 16.0.4145.4 Developer Edition (64-bit) RTM CU15
(local)\ADV_2005_X86 9.00.5000.00 MSSQL$ADV_2005_X86 9.00.5000.00 Express Edition with Advanced SP4
(local)\ADV_2008R2_X64 10.50.6000.34 MSSQL$ADV_2008R2_X64 10.50.6000.34 Express Edition with Advanced SP3
(local)\ADV_2008_X86 10.0.1600.22 MSSQL$ADV_2008_X86 10.0.6000.29 Express Edition with Advanced SP4
(local)\DEV2022UTF8 16.0.1000.6 MSSQL$DEV2022UTF8 16.0.4145.4 Developer Edition (64-bit) RTM CU15
(local)\DEV_2008R2_X64 10.50.6000.34 MSSQL$DEV_2008R2_X64 10.50.6000.34 Developer Edition (64-bit) SP3
(local)\DEV_2008_X64 10.0.6000.29 MSSQL$DEV_2008_X64 10.0.6000.29 Developer Edition (64-bit) SP4
(local)\DEV_2012_X64 11.0.7001.0 MSSQL$DEV_2012_X64 11.0.7001.0 Developer Edition (64-bit) SP4
(local)\DEV_2014_X64 12.0.6024.0 MSSQL$DEV_2014_X64 12.0.6024.0 Developer Edition (64-bit) SP3
(local)\DEV_2016 13.0.6441.1 MSSQL$DEV_2016 13.0.6441.1 Developer Edition (64-bit) SP3
(local)\DEV_2017 14.0.1000.169 MSSQL$DEV_2017 14.0.3456.2 Developer Edition (64-bit) RTM CU31
(local)\DEV_2019 15.0.2000.5 MSSQL$DEV_2019 15.0.4385.2 Developer Edition (64-bit) RTM CU28</code></pre>
<p><br/></p>
<p>🌟 SQL Server 2025 and LocalDB 2025 are also supported</p>
<div class="sourceCode" id="cb9"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="op">@(</span>Find-Local-SqlServers<span class="op">)</span> <span class="op">+</span> <span class="op">@(</span>Find-LocalDb-SqlServers<span class="op">)</span> <span class="op">|</span> </span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> Populate-Local-SqlServer-Version <span class="op">|</span> </span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">Select-Object</span> <span class="op">-</span>Property Instance<span class="op">,</span> Version <span class="op">|</span></span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">Format-Table</span> <span class="op">-</span>AutoSize <span class="op">|</span> </span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-String</span> <span class="op">-</span>Width <span class="dv">1234</span> <span class="op">|</span> </span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-Host</span></span></code></pre></div>
<pre><code>Instance Version
-------- -------
(local) 17.0.1000.7 Enterprise Developer Edition (64-bit) RTM
(LocalDB)\MSSQLLocalDB 17.0.1000.7 LocalDB Express Edition (64-bit) RTM</code></pre>
<p><br/></p>
<p>🌟 List Installed SQL Server Services</p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>Find-Local-SqlServers <span class="op">|</span> </span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span> <span class="op">{</span> <span class="va">$_</span><span class="op">.</span><span class="fu">Service</span> <span class="op">}</span> <span class="op">|</span> </span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span> <span class="op">{</span> <span class="fu">Get-Service</span> <span class="op">-</span>Name <span class="va">$_</span> <span class="op">}</span> <span class="op">|</span> </span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">ft</span> <span class="op">-</span>AutoSize <span class="op">|</span></span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-Host</span></span></code></pre></div>
<pre><code>Status Name DisplayName
------ ---- -----------
Running MSSQL$ADV_2005_X86 SQL Server (ADV_2005_X86)
Running MSSQL$ADV_2008_X86 SQL Server (ADV_2008_X86)
Running MSSQL$ADV_2008R2_X64 SQL Server (ADV_2008R2_X64)
Running MSSQL$DEV_2008_X64 SQL Server (DEV_2008_X64)
Running MSSQL$DEV_2008R2_X64 SQL Server (DEV_2008R2_X64)
Running MSSQL$DEV_2012_X64 SQL Server (DEV_2012_X64)
Running MSSQL$DEV_2014_X64 SQL Server (DEV_2014_X64)
Running MSSQL$DEV_2016 SQL Server (DEV_2016)
Running MSSQL$DEV_2017 SQL Server (DEV_2017)
Running MSSQL$DEV_2019 SQL Server (DEV_2019)
Running MSSQL$DEV2022UTF8 SQL Server (DEV2022UTF8)
Running MSSQLSERVER SQL Server (MSSQLSERVER)
</code></pre>
<p><br/></p>
<p>🌟 Wait up to 30 seconds for the SQL Server health check to pass, and
return its version</p>
<div class="sourceCode" id="cb13"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>Query-SqlServer-Version <span class="op">-</span>Title <span class="st">"Default MS SQL SERVER"</span> <span class="op">-</span>Instance <span class="st">"(local)"</span> <span class="op">-</span>Timeout <span class="dv">30</span></span></code></pre></div>
<p><br/></p>
<p>🌟 Wait up to 30 seconds for the SQL Server health check to pass, and
return its version (on Linux)</p>
<div class="sourceCode" id="cb14"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>Query-SqlServer-Version <span class="op">-</span>Title <span class="st">"SQL Server"</span> `</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span>ConnectionString <span class="st">"Data Source=localhost,1433;User ID=sa;Password=passw0rd!;Encrypt=False;"</span> `</span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span>Timeout <span class="dv">30</span></span></code></pre></div>
<p><br/></p>
<p>🌟 Start SQL Server Instances that are currently stopped</p>
<div class="sourceCode" id="cb15"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>Find-Local-SqlServers <span class="op">|</span> </span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span> <span class="op">{</span> <span class="va">$_</span><span class="op">.</span><span class="fu">Service</span> <span class="op">}</span> <span class="op">|</span> </span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span> <span class="op">{</span> <span class="fu">Get-Service</span> <span class="op">-</span>Name <span class="va">$_</span> <span class="op">}</span> <span class="op">|</span> </span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a> <span class="op">?</span> <span class="op">{</span> <span class="va">$_</span><span class="op">.</span><span class="fu">Status</span> <span class="op">-ne</span> <span class="st">"Running"</span> <span class="op">}</span> <span class="op">|</span></span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span> <span class="op">{</span> <span class="fu">Write-Host</span> <span class="st">"Starting </span><span class="op">$(</span><span class="va">$_</span><span class="op">.</span><span class="fu">Name</span><span class="op">)</span><span class="st">"</span><span class="op">;</span> <span class="fu">Start-Service</span> <span class="st">"</span><span class="op">$(</span><span class="va">$_</span><span class="op">.</span><span class="fu">Name</span><span class="op">)</span><span class="st">"</span> <span class="op">}</span></span></code></pre></div>
<p><br/></p>
<p>🌟 Stop SQL Server Instances that are currently running</p>
<div class="sourceCode" id="cb16"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a>Find-Local-SqlServers <span class="op">|</span> </span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span> <span class="op">{</span> <span class="va">$_</span><span class="op">.</span><span class="fu">Service</span> <span class="op">}</span> <span class="op">|</span> </span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span> <span class="op">{</span> <span class="fu">Get-Service</span> <span class="op">-</span>Name <span class="va">$_</span> <span class="op">}</span> <span class="op">|</span> </span>
<span id="cb16-4"><a href="#cb16-4" aria-hidden="true" tabindex="-1"></a> <span class="op">?</span> <span class="op">{</span> <span class="va">$_</span><span class="op">.</span><span class="fu">Status</span> <span class="op">-ne</span> <span class="st">"Stopped"</span> <span class="op">}</span> <span class="op">|</span></span>
<span id="cb16-5"><a href="#cb16-5" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span> <span class="op">{</span> <span class="fu">Write-Host</span> <span class="st">"Stopping </span><span class="op">$(</span><span class="va">$_</span><span class="op">.</span><span class="fu">Name</span><span class="op">)</span><span class="st">"</span><span class="op">;</span> <span class="fu">Stop-Service</span> <span class="st">"</span><span class="op">$(</span><span class="va">$_</span><span class="op">.</span><span class="fu">Name</span><span class="op">)</span><span class="st">"</span> <span class="op">-</span>Force <span class="op">}</span></span></code></pre></div>
<p><br/></p>
<h2 id="sql-server-localdb-functions">SQL Server LocalDB functions</h2>
<p>🌟 Install all the versions of SQL Server LocalDB:</p>
<div class="sourceCode" id="cb17"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>Setup-SqlServers <span class="st">"</span></span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a><span class="st"> 2025 LocalDB,</span></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a><span class="st"> 2022 LocalDB,</span></span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a><span class="st"> 2019 LocalDB,</span></span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a><span class="st"> 2017 LocalDB,</span></span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a><span class="st"> 2016 LocalDB,</span></span>
<span id="cb17-7"><a href="#cb17-7" aria-hidden="true" tabindex="-1"></a><span class="st"> 2014 LocalDB,</span></span>
<span id="cb17-8"><a href="#cb17-8" aria-hidden="true" tabindex="-1"></a><span class="st"> 2012 LocalDB</span></span>
<span id="cb17-9"><a href="#cb17-9" aria-hidden="true" tabindex="-1"></a><span class="st">"</span></span></code></pre></div>
<p><br/></p>
<p>🌟 List Installed SQL Server LocalDB Versions:</p>
<div class="sourceCode" id="cb18"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a>Find-LocalDb-Versions <span class="op">|</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ft</span> <span class="op">-</span>Property ShortVersion<span class="op">,</span> InstallerVersion <span class="op">-</span>AutoSize <span class="op">|</span></span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-String</span> <span class="op">-</span>Width <span class="dv">1234</span> <span class="op">|</span></span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-Host</span></span></code></pre></div>
<pre><code>ShortVersion InstallerVersion
------------ ----------------
16.0 16.0.4175.1
15.0 15.0.4420.2
14.0 14.0.3456.2
13.0 13.3.6441.1
12.0 12.3.6024.0
11.0 11.4.7001.0</code></pre>
<p><br/></p>
<p>🌟 List SQL Server LocalDB Instances and their version:</p>
<div class="sourceCode" id="cb20"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>Find-LocalDb-SqlServers <span class="op">|</span> Populate-Local-SqlServer-Version <span class="op">|</span></span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ft</span> <span class="op">-</span>AutoSize <span class="op">|</span></span>
<span id="cb20-3"><a href="#cb20-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-String</span> <span class="op">-</span>Width <span class="dv">1234</span> <span class="op">|</span></span>
<span id="cb20-4"><a href="#cb20-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">Out-Host</span></span></code></pre></div>
<pre><code>Instance Version
-------- -------
(LocalDB)\LocalDB-v11.0 11.0.7001.0 LocalDB Express Edition (64-bit) SP4
(LocalDB)\LocalDB-v12.0 12.0.6024.0 LocalDB Express Edition (64-bit) SP3
(LocalDB)\LocalDB-v13.0 13.0.6300.2 LocalDB Express Edition (64-bit) SP3
(LocalDB)\LocalDB-v14.0 14.0.3456.2 LocalDB Express Edition (64-bit) RTM CU31
(LocalDB)\LocalDB-v15.0 15.0.4420.2 LocalDB Express Edition (64-bit) RTM CU31
(LocalDB)\LocalDB-v16.0 16.0.4175.1 LocalDB Express Edition (64-bit) RTM CU17
(LocalDB)\MSSQLLocalDB 16.0.4175.1 LocalDB Express Edition (64-bit) RTM CU17
(LocalDB)\v11.0 11.0.7001.0 LocalDB Express Edition (64-bit) SP4</code></pre>
<p><br/></p>
<p>🌟 Create SQL Server LocalDB Instance per version using pattern
<code>LocalDB-v{Version}</code>:</p>
<div class="sourceCode" id="cb22"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="cf">foreach</span><span class="op">(</span><span class="va">$localDb</span> <span class="kw">in</span> Find-LocalDb-Versions<span class="op">)</span> <span class="op">{</span></span>
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a> <span class="va">$instance</span> <span class="op">=</span> <span class="st">"LocalDB-v</span><span class="op">$(</span><span class="va">$localDb</span><span class="op">.</span><span class="fu">ShortVersion</span><span class="op">)</span><span class="st">"</span></span>
<span id="cb22-3"><a href="#cb22-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">Write-Host</span> <span class="st">"Creating Instance </span><span class="va">$instance</span><span class="st"> version </span><span class="op">$(</span><span class="va">$localDb</span><span class="op">.</span><span class="fu">ShortVersion</span><span class="op">)</span><span class="st">"</span></span>
<span id="cb22-4"><a href="#cb22-4" aria-hidden="true" tabindex="-1"></a> <span class="va">$isCreated</span> <span class="op">=</span> Create-LocalDB-Instance `</span>
<span id="cb22-5"><a href="#cb22-5" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span>InstanceName <span class="va">$instance</span> `</span>
<span id="cb22-6"><a href="#cb22-6" aria-hidden="true" tabindex="-1"></a> <span class="op">-</span>OptionalVersion <span class="va">$localDb</span><span class="op">.</span><span class="fu">ShortVersion</span></span>
<span id="cb22-7"><a href="#cb22-7" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p><br/></p>
<p>🌟 Uninstall any pre-installed LocalDB version:</p>
<div class="sourceCode" id="cb23"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a>Uninstall-LocalDB-List <span class="st">"*"</span></span></code></pre></div>
<p><br/></p>
<p>🌟 Uninstall LocalDB 2012 and 2014 if they are installed:</p>
<div class="sourceCode" id="cb24"><pre
class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a>Uninstall-LocalDB-List <span class="st">"2012"</span><span class="op">,</span> <span class="st">"2014"</span></span></code></pre></div>
<!-- Add copy buttons -->
<script>
var copyIcon;
copyIcon = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M10 1.75a.75.75 0 0 1 .75.75v.75h1.5A2.75 2.75 0 0 1 15 6v6.25A2.75 2.75 0 0 1 12.25 15H6a.75.75 0 0 1 0-1.5h6.25c.69 0 1.25-.56 1.25-1.25V6c0-.69-.56-1.25-1.25-1.25h-1.5v.75a.75.75 0 0 1-1.5 0V2.5a.75.75 0 0 1 .75-.75ZM2.75 3A2.75 2.75 0 0 0 0 5.75v6.5A2.75 2.75 0 0 0 2.75 15h6.5A2.75 2.75 0 0 0 12 12.25v-6.5A2.75 2.75 0 0 0 9.25 3h-6.5Zm0 1.5h6.5c.69 0 1.25.56 1.25 1.25v6.5c0 .69-.56 1.25-1.25 1.25h-6.5C2.06 13.5 1.5 12.94 1.5 12.25v-6.5C1.5 5.06 2.06 4.5 2.75 4.5Z"/></svg>
`;
copyIcon = `
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24">
<path d="M16 1H4a2 2 0 0 0-2 2v12h2V3h12V1Zm3 4H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2Zm0 16H8V7h11v14Z"/>
</svg>`;
var checkIcon = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M13.78 3.72a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 8.78a.75.75 0 1 1 1.06-1.06l2.72 2.72 6.72-6.72a.75.75 0 0 1 1.06 0Z"/></svg>
`;
checkIcon = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor">
<path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 0 0-1.06 0L6.5 10.44 3.28 7.22a.75.75 0 1 0-1.06 1.06l3.75 3.75a.75.75 0 0 0 1.06 0l6.75-6.75a.75.75 0 0 0 0-1.06z"/>
</svg>
`;
document.querySelectorAll('pre code').forEach((block) => {
const button = document.createElement('button');
button.className = 'copy-btn';
button.innerHTML = copyIcon;
button.addEventListener('click', () => {
navigator.clipboard.writeText(block.innerText).then(() => {
button.innerHTML = checkIcon;
setTimeout(() => button.innerHTML = copyIcon, 1500);
});
});
block.parentNode.appendChild(button);
});
</script>
<!-- anchors js -->
<script>
function slugify(text) {
return text.toLowerCase()
.trim()
.replace(/[^a-z0-9\s-]/g, '') // Remove special chars
.replace(/\s+/g, '-') // Replace spaces with dashes
.replace(/-+/g, '-'); // Collapse multiple dashes
}
document.querySelectorAll('h1, h2, h3, h4, h5, h6').forEach(header => {
var slug = slugify(header.textContent);
header.id = slug;
const anchor = document.createElement('a');
anchor.href = '#' + slug;
anchor.className = 'header-anchor';
anchor.setAttribute('aria-label', 'Permalink: ' + header.textContent);
anchor.textContent = '🔗';
// TODO: Incorrect svg colors for dark theme
// anchor.innerHTML = `
// <svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true">
// <path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path>
// </svg>`;
/*
anchor.addEventListener('click', e => {
e.preventDefault();
if (location.hash === `#`) {
history.replaceState(null, null, `#`);
} else {
location.hash = slug;
}
});
*/
header.appendChild(anchor);
});
</script>
</body>
</html>