|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
List All Instances of SQL ServerI am trying to generate a list of all available SQL Servers (named instances and all) on a network. I have seen over and over again to use SQLDMO or isql -L. The problem that I am having is that these methods only seem to want to return one instance from each computer. ex. Computer "Main" has Main Main\Instance1 Main\Instance2 These methods are only returning "Main" in the list and not the rest of the named instances. I have tried everything I can think of, including making sure the protocols "named pipes" and "TCP/IP" are activated for each instance. No matter what I have tried these Names won't return. I have resorted to reading the registry to get get the instances for the local computer from the "InstalledInstances" key. This method is fine for the local computer but won't work for network computers. Do any of you have any suggestions for returning a complete list of all available servers? Is there something I'm doing wrong or missing? Also I would like to return a list of local servers when the network cable is unplugged. Do you have a suggestion for how to solve this problem? Thanks for any help, Ken Ken,
I was trying to do the same thing. Only thing I found that returned my Instances was the following. Only thing is not sure how well this will work in a network environment since this is reading the registry. If you figure how to do it on a network or a different way let me know your solution. RegistryKey objInstances = Registry.LocalMachine; objInstances = objInstances.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL", true); foreach (string Keyname in objInstances.GetValueNames()) { tvTableInfo.Nodes.Add(Keyname); } Show quote "Ken" <K**@discussions.microsoft.com> wrote in message news:E4BE412C-A98C-4522-B902-5AC1398F2F72@microsoft.com... > Hi all, > I am trying to generate a list of all available SQL Servers (named > instances > and all) on a network. I have seen over and over again to use SQLDMO or > isql > -L. > > The problem that I am having is that these methods only seem to want to > return one instance from each computer. > ex. Computer "Main" has > Main > Main\Instance1 > Main\Instance2 > > These methods are only returning "Main" in the list and not the rest of > the > named instances. I have tried everything I can think of, including making > sure the protocols "named pipes" and "TCP/IP" are activated for each > instance. No matter what I have tried these Names won't return. I have > resorted to reading the registry to get get the instances for the local > computer from the "InstalledInstances" key. > This method is fine for the local computer but won't work for network > computers. > > Do any of you have any suggestions for returning a complete list of all > available servers? > > Is there something I'm doing wrong or missing? > > Also I would like to return a list of local servers when the network cable > is unplugged. Do you have a suggestion for how to solve this problem? > > Thanks for any help, > Ken Thanks, but that is essentially what I accomplished by reading the
"NamedInstances" key. That type of situation works well for the local computer but like you said, it won't work for network machines. Thanks for the input though. Show quote "JP" wrote: > Ken, > I was trying to do the same thing. Only thing I found that returned my > Instances was the following. > Only thing is not sure how well this will work in a network environment > since this is reading the registry. If you figure how to do it on a network > or a different way let me know your solution. > > RegistryKey objInstances = Registry.LocalMachine; > > objInstances = objInstances.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL > Server\Instance Names\SQL", true); > > foreach (string Keyname in objInstances.GetValueNames()) > > { > > tvTableInfo.Nodes.Add(Keyname); > > } > > > > > > "Ken" <K**@discussions.microsoft.com> wrote in message > news:E4BE412C-A98C-4522-B902-5AC1398F2F72@microsoft.com... > > Hi all, > > I am trying to generate a list of all available SQL Servers (named > > instances > > and all) on a network. I have seen over and over again to use SQLDMO or > > isql > > -L. > > > > The problem that I am having is that these methods only seem to want to > > return one instance from each computer. > > ex. Computer "Main" has > > Main > > Main\Instance1 > > Main\Instance2 > > > > These methods are only returning "Main" in the list and not the rest of > > the > > named instances. I have tried everything I can think of, including making > > sure the protocols "named pipes" and "TCP/IP" are activated for each > > instance. No matter what I have tried these Names won't return. I have > > resorted to reading the registry to get get the instances for the local > > computer from the "InstalledInstances" key. > > This method is fine for the local computer but won't work for network > > computers. > > > > Do any of you have any suggestions for returning a complete list of all > > available servers? > > > > Is there something I'm doing wrong or missing? > > > > Also I would like to return a list of local servers when the network cable > > is unplugged. Do you have a suggestion for how to solve this problem? > > > > Thanks for any help, > > Ken > > > I am using sql-dmo to get list of instances. I have the same problem. But
i figured out that when i disable my local firewall application sql-dmo returns all SQL Server instances. So try to temporarily turn off your firewalls. On Fri, 19 Aug 2005 02:22:04 +0300, Ken <K**@discussions.microsoft.com> wrote: Show quote > Hi all, > I am trying to generate a list of all available SQL Servers (named > instances > and all) on a network. I have seen over and over again to use SQLDMO or > isql > -L. > > The problem that I am having is that these methods only seem to want to > return one instance from each computer. > ex. Computer "Main" has > Main > Main\Instance1 > Main\Instance2 > > These methods are only returning "Main" in the list and not the rest of > the > named instances. I have tried everything I can think of, including > making > sure the protocols "named pipes" and "TCP/IP" are activated for each > instance. No matter what I have tried these Names won't return. I have > resorted to reading the registry to get get the instances for the local > computer from the "InstalledInstances" key. > This method is fine for the local computer but won't work for network > computers. > > Do any of you have any suggestions for returning a complete list of all > available servers? > > Is there something I'm doing wrong or missing? > > Also I would like to return a list of local servers when the network > cable > is unplugged. Do you have a suggestion for how to solve this problem? > > Thanks for any help, > Ken That was it.
I was using a software firewall and had disabled that to see if it was the problem, and I had assumed that the windows firewall was disabled(as I had previously disabled it). Once I disabled the windows firewall all instances started showing up. Thanks for the response, Ken Show quote "Igor Solodovnikov" wrote: > I am using sql-dmo to get list of instances. I have the same problem. But > i figured out that when i disable my local firewall application sql-dmo > returns all SQL Server instances. So try to temporarily turn off your > firewalls. > > On Fri, 19 Aug 2005 02:22:04 +0300, Ken <K**@discussions.microsoft.com> > wrote: > > > Hi all, > > I am trying to generate a list of all available SQL Servers (named > > instances > > and all) on a network. I have seen over and over again to use SQLDMO or > > isql > > -L. > > > > The problem that I am having is that these methods only seem to want to > > return one instance from each computer. > > ex. Computer "Main" has > > Main > > Main\Instance1 > > Main\Instance2 > > > > These methods are only returning "Main" in the list and not the rest of > > the > > named instances. I have tried everything I can think of, including > > making > > sure the protocols "named pipes" and "TCP/IP" are activated for each > > instance. No matter what I have tried these Names won't return. I have > > resorted to reading the registry to get get the instances for the local > > computer from the "InstalledInstances" key. > > This method is fine for the local computer but won't work for network > > computers. > > > > Do any of you have any suggestions for returning a complete list of all > > available servers? > > > > Is there something I'm doing wrong or missing? > > > > Also I would like to return a list of local servers when the network > > cable > > is unplugged. Do you have a suggestion for how to solve this problem? > > > > Thanks for any help, > > Ken > > |
|||||||||||||||||||||||