0

SQL Server 2008 does not install DMO by default. Is there a function or script I can use from the command prompt to check remote servers to see if DMO has already been installed? We were using a registry key check but thought that might not be the best option. Any advice is appreciated!

Ddono25
  • 165
  • 3
  • 13

1 Answers1

0

I'm assuming you mean SMO (DMO was replaced by SMO in SQL 2005).

You can do this as a quick and dirty test within Powershell:

PS C:\> [Reflection.Assembply]::LoadWithPartialName("Microsoft.SqlServer.Smo")

If SMO is registered it'll come back with some info on where it found the SMO dll and what version it is.

GAC     Version          Location
---     -------          --------
True    v2.0.50727       C:\.........

You could also use this VBS script if you don't want to do it in Powershell:

Dim sqlServer
set sqlServer = CreateObject("Microsoft.SQLServer.Management.SMO.Server")
set sqlServer = nothing

If it returns a runtime error "ActiveX component can't create object: 'Microsoft.SqlServer.Smo.Server'" then SMO not installed (or at least not registered).

squillman
  • 37,883
  • 12
  • 92
  • 146