File tree Expand file tree Collapse file tree 2 files changed +71
-2
lines changed Expand file tree Collapse file tree 2 files changed +71
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,41 @@ LoadSQLSMO
68
68
69
69
70
70
# Load Additional Assemblies
71
- add-type - path " C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\Microsoft.SqlServer.Dac.dll"
71
+ $dacver = $null ;
72
+ $dacdll = " C:\Program Files (x86)\Microsoft SQL Server\100\DAC\bin\Microsoft.SqlServer.Dac.dll"
73
+ if ((test-path - path $dacdll ))
74
+ {
75
+ $dacver = 2008
76
+ add-type - path " C:\Program Files (x86)\Microsoft SQL Server\100\DAC\bin\Microsoft.SqlServer.Dac.dll"
77
+ }
78
+
79
+ $dacdll = " C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\Microsoft.SqlServer.Dac.dll"
80
+ if ((test-path - path $dacdll ))
81
+ {
82
+ $dacver = 2012
83
+ add-type - path " C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\Microsoft.SqlServer.Dac.dll"
84
+ }
85
+
86
+ $dacdll = " C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\Microsoft.SqlServer.Dac.dll"
87
+ if ((test-path - path $dacdll ))
88
+ {
89
+ $dacver = 2014
90
+ add-type - path " C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\Microsoft.SqlServer.Dac.dll"
91
+ }
92
+
93
+ $dacdll = " C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin\Microsoft.SqlServer.Dac.dll"
94
+ if ((test-path - path $dacdll ))
95
+ {
96
+ $dacver = 2016
97
+ add-type - path " C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin\Microsoft.SqlServer.Dac.dll"
98
+ }
99
+
100
+ If (! ($dacver ))
101
+ {
102
+ Write-Output " Microsoft.SqlServer.Dac.dll not found, exiting"
103
+ exit
104
+ }
105
+
72
106
73
107
74
108
Original file line number Diff line number Diff line change @@ -53,8 +53,43 @@ Write-Output "Server $SQLInstance"
53
53
Import-Module " .\LoadSQLSmo.psm1"
54
54
LoadSQLSMO
55
55
56
+
56
57
# Load Additional Assemblies
57
- add-type - path " C:\Program Files (x86)\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
58
+ $dmfver = $null ;
59
+ $dmfdll = " C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
60
+ if ((test-path - path $dmfdll ))
61
+ {
62
+ $dmfver = 2008
63
+ add-type - path " C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
64
+ }
65
+
66
+ $dmfdll = " C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
67
+ if ((test-path - path $dmfdll ))
68
+ {
69
+ $dmfver = 2012
70
+ add-type - path " C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
71
+ }
72
+
73
+ $dmfdll = " C:\Program Files (x86)\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
74
+ if ((test-path - path $dmfdll ))
75
+ {
76
+ $dmfver = 2014
77
+ add-type - path " C:\Program Files (x86)\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
78
+ }
79
+
80
+ $dmfdll = " C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
81
+ if ((test-path - path $dmfdll ))
82
+ {
83
+ $dmfver = 2016
84
+ add-type - path " C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
85
+ }
86
+
87
+ If (! ($dmfver ))
88
+ {
89
+ Write-Output " Microsoft.SqlServer.Dmf.dll not found, exiting"
90
+ exit
91
+ }
92
+
58
93
59
94
60
95
# Server connection check
You can’t perform that action at this time.
0 commit comments