Hi, iam using this script to connect to the default instance of a SQL Server
(7 or 2000)
strcomputer = wscript.arguments(0)
Set oServer=CreateObject("SQLDMO.Sqlserver")
oserver.loginsecure = true
oServer.Connect strComputer
The problem is:
When i try to connect to a server that has many instances
(MSSQLSERVER$XXXXXX) i cant connect. This scripts only works with the defaul
t
mssqlserver. The question is how can connect to a server and list the
available instances instead of hardcoding in code (Like strcomputer &
"\Instance") using vbscript or other shell tool. (The discover tool like osq
l
-L doesn't work, because it cant detect server over lot of networks)
Thanks all.Use the ListAvailableServers Method of the application object.
INF: How to Enumerate Available SQL Servers Using SQLDMO
http://support.microsoft.com/defaul...b;en-us;Q287737
AMB
"Tinchos" wrote:
> Hi, iam using this script to connect to the default instance of a SQL Serv
er
> (7 or 2000)
> strcomputer = wscript.arguments(0)
> Set oServer=CreateObject("SQLDMO.Sqlserver")
> oserver.loginsecure = true
> oServer.Connect strComputer
> The problem is:
> When i try to connect to a server that has many instances
> (MSSQLSERVER$XXXXXX) i cant connect. This scripts only works with the defa
ult
> mssqlserver. The question is how can connect to a server and list the
> available instances instead of hardcoding in code (Like strcomputer &
> "\Instance") using vbscript or other shell tool. (The discover tool like o
sql
> -L doesn't work, because it cant detect server over lot of networks)
> Thanks all.|||Thanks Alejandro. But it doesn't work neither. It's the same that use the
osql -L (only works on local network)
I need to find a method to connect to a server and list the available
instances with dmo.
Thanks !!
"Alejandro Mesa" wrote:
> Use the ListAvailableServers Method of the application object.
> INF: How to Enumerate Available SQL Servers Using SQLDMO
> http://support.microsoft.com/defaul...b;en-us;Q287737
>
> AMB
> "Tinchos" wrote:
>|||See if querying master.dbo.sysservers or executing sp_helpserver helps.
AMB
"Tinchos" wrote:
> Thanks Alejandro. But it doesn't work neither. It's the same that use the
> osql -L (only works on local network)
> I need to find a method to connect to a server and list the available
> instances with dmo.
> Thanks !!
> "Alejandro Mesa" wrote:
>|||Nop, i have a about 50 sql server over the network.
New sql servers are installed with instances, like this:
SERVER\UNLAMXEX
SERVER\UNLAMXFO
SERVER\UNLAMXPR
I need to specify the instance to connect with isql o other. I need some
scripting tool to detects automatically the instances.
Thanks.
Martin
"Alejandro Mesa" wrote:
> See if querying master.dbo.sysservers or executing sp_helpserver helps.
>
> AMB
> "Tinchos" wrote:
>
Friday, February 24, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment