Hi,

I do some work for several companies and I got a request to list all the
database servers with al the databases they contain. I know how I can list
the databases. However I never had to search the network for databases. I
know that this company is only using MySQL servers on Windows. Can somebody
tell me how I can retrieve them on the network with a script or an app?

Wkr,
Arjan.

RE: Searching for MySQL servers on the network by Stewie

Stewie
Thu Jun 23 15:19:04 CDT 2005

Ice Man,

I think this is the most commonly asked question by infrastructure geeks
about SQL (Me)... I found that if you execute "isql.exe -L" from a server or
workstation with sql server or msde installed you will get what you need...

HTH,

Stew

"Blue Ice" wrote:

> Hi,
>
> I do some work for several companies and I got a request to list all the
> database servers with al the databases they contain. I know how I can list
> the databases. However I never had to search the network for databases. I
> know that this company is only using MySQL servers on Windows. Can somebody
> tell me how I can retrieve them on the network with a script or an app?
>
> Wkr,
> Arjan.
>
>
>

Re: Searching for MySQL servers on the network by Blue

Blue
Thu Jun 23 16:04:49 CDT 2005

Stew,

I don't think that you understood what I meant...
I am not looking for a solution for MS SQL Server or MSDE, because that is
an easy one. I am looking for a solution to find the MySQL servers.

Arjan.


"Stewie" <Stewie@discussions.microsoft.com> wrote in message
news:48EE49D7-65BB-4776-A7BB-6C158FCAA0A1@microsoft.com...
> Ice Man,
>
> I think this is the most commonly asked question by infrastructure geeks
> about SQL (Me)... I found that if you execute "isql.exe -L" from a server
> or
> workstation with sql server or msde installed you will get what you
> need...
>
> HTH,
>
> Stew
>
> "Blue Ice" wrote:
>
>> Hi,
>>
>> I do some work for several companies and I got a request to list all the
>> database servers with al the databases they contain. I know how I can
>> list
>> the databases. However I never had to search the network for databases. I
>> know that this company is only using MySQL servers on Windows. Can
>> somebody
>> tell me how I can retrieve them on the network with a script or an app?
>>
>> Wkr,
>> Arjan.
>>
>>
>>



Re: Searching for MySQL servers on the network by Blue

Blue
Thu Jun 23 16:15:34 CDT 2005

Actually, I think that I have to send a signal to the computers in the
network and wait until a computer answers. So when the computer is a MySQL
server, it will tell me that it is a MySQL server.

Arjan.



Re: Searching for MySQL servers on the network by dmsys

dmsys
Sat Jun 25 03:24:32 CDT 2005

What process does mysql server execute on the computer? For instance, a
computer running Microsoft Exchange Server _and_ is a mailbox server (not a
front-end) will certainly have "store.exe" running. You can then run a command
"tasklist" which dumps all the running processes. If instr store.exe, the
computer is a mailbox server. A similar analogy should help with mysql.

Blue Ice wrote:

> Actually, I think that I have to send a signal to the computers in the
> network and wait until a computer answers. So when the computer is a MySQL
> server, it will tell me that it is a MySQL server.
>
> Arjan.


Re: Searching for MySQL servers on the network by Blue

Blue
Sat Jun 25 03:47:42 CDT 2005

That might be a good idea, although I am not sure that it runs just one
single process. I believe that there 4 executables that can be used to start
MySQL and it can be started as a service. However I will investigate this
idea. By the way, would this create a lot overhead?
Thank you for the idea!

Arjan.


"dmsys" <dmsys.caleb1@ntlworld.com> wrote in message
news:42BD14E9.A74297A9@ntlworld.com...
> What process does mysql server execute on the computer? For instance, a
> computer running Microsoft Exchange Server _and_ is a mailbox server (not
> a
> front-end) will certainly have "store.exe" running. You can then run a
> command
> "tasklist" which dumps all the running processes. If instr store.exe, the
> computer is a mailbox server. A similar analogy should help with mysql.
>
> Blue Ice wrote:
>
>> Actually, I think that I have to send a signal to the computers in the
>> network and wait until a computer answers. So when the computer is a
>> MySQL
>> server, it will tell me that it is a MySQL server.
>>
>> Arjan.
>



Re: Searching for MySQL servers on the network by dmsys

dmsys
Mon Jun 27 07:17:40 CDT 2005

No, not a lot of overhead, at least ours is very fast. You could use a simple
batch file (.bat) like this, although it could be a lot more elaborate with wsh:

tasklist /s server01 > server01.txt
tasklist /s server02 > server02.txt
tasklist /s server03 > server03.txt
rem replace "processX.exe" with your target server's process
findstr "processX.exe", server*.txt > svrproc.txt
del server*.txt
notepad svrproc.txt

or you could further refine this elementary method to be more relevant to your
needs:

tasklist /s server01 > servers.txt
tasklist /s server02 >> servers.txt
tasklist /s server03 >> servers.txt
rem replace "processSQ1.exe" with your target server's process
echo ******************** SQ1 processes > svrproc.txt
findstr processSQ1.exe, servers.txt > svrproc.txt
echo ******************** SQ2 processes >> svrproc.txt
rename servers.txt servers2.txt
findstr "processSQ2.exe", servers2.txt >> svrproc.txt
echo ******************** SQ3 processes >> svrproc.txt
rename servers2.txt servers3.txt
findstr "processSQ3.exe", servers3.txt >> svrproc.txt
echo "" >> svrproc.txt
del serv*.txt
notepad svrproc.txt

Note that if you use IPaddresses instead of hostnames, the script could hang if
the server is unavailable.
If you need more than the default four columns returned by tasklist, you may
have to use wmi. Alternatively, if you find methods to return more than 4
columns, or to return specific columns, please post.

Regards.


Blue Ice wrote:

> That might be a good idea, although I am not sure that it runs just one
> single process. I believe that there 4 executables that can be used to start
> MySQL and it can be started as a service. However I will investigate this
> idea. By the way, would this create a lot overhead?
> Thank you for the idea!
>
> Arjan.
>
> "dmsys" <dmsys.caleb1@ntlworld.com> wrote in message
> news:42BD14E9.A74297A9@ntlworld.com...
> > What process does mysql server execute on the computer? For instance, a
> > computer running Microsoft Exchange Server _and_ is a mailbox server (not
> > a
> > front-end) will certainly have "store.exe" running. You can then run a
> > command
> > "tasklist" which dumps all the running processes. If instr store.exe, the
> > computer is a mailbox server. A similar analogy should help with mysql.
> >
> > Blue Ice wrote:
> >
> >> Actually, I think that I have to send a signal to the computers in the
> >> network and wait until a computer answers. So when the computer is a
> >> MySQL
> >> server, it will tell me that it is a MySQL server.
> >>
> >> Arjan.
> >


Re: Searching for MySQL servers on the network by dmsys

dmsys
Mon Jun 27 07:20:51 CDT 2005

Please remove the quotes from findstr "processX.exe" (etc.)

dmsys wrote:

> No, not a lot of overhead, at least ours is very fast. You could use a simple
> batch file (.bat) like this, although it could be a lot more elaborate with wsh:
>
> tasklist /s server01 > server01.txt
> tasklist /s server02 > server02.txt
> tasklist /s server03 > server03.txt
> rem replace "processX.exe" with your target server's process
> findstr "processX.exe", server*.txt > svrproc.txt
> del server*.txt
> notepad svrproc.txt
>
> or you could further refine this elementary method to be more relevant to your
> needs:
>
> tasklist /s server01 > servers.txt
> tasklist /s server02 >> servers.txt
> tasklist /s server03 >> servers.txt
> rem replace "processSQ1.exe" with your target server's process
> echo ******************** SQ1 processes > svrproc.txt
> findstr processSQ1.exe, servers.txt > svrproc.txt
> echo ******************** SQ2 processes >> svrproc.txt
> rename servers.txt servers2.txt
> findstr "processSQ2.exe", servers2.txt >> svrproc.txt
> echo ******************** SQ3 processes >> svrproc.txt
> rename servers2.txt servers3.txt
> findstr "processSQ3.exe", servers3.txt >> svrproc.txt
> echo "" >> svrproc.txt
> del serv*.txt
> notepad svrproc.txt
>
> Note that if you use IPaddresses instead of hostnames, the script could hang if
> the server is unavailable.
> If you need more than the default four columns returned by tasklist, you may
> have to use wmi. Alternatively, if you find methods to return more than 4
> columns, or to return specific columns, please post.
>
> Regards.
>
> Blue Ice wrote:
>
> > That might be a good idea, although I am not sure that it runs just one
> > single process. I believe that there 4 executables that can be used to start
> > MySQL and it can be started as a service. However I will investigate this
> > idea. By the way, would this create a lot overhead?
> > Thank you for the idea!
> >
> > Arjan.
> >
> > "dmsys" <dmsys.caleb1@ntlworld.com> wrote in message
> > news:42BD14E9.A74297A9@ntlworld.com...
> > > What process does mysql server execute on the computer? For instance, a
> > > computer running Microsoft Exchange Server _and_ is a mailbox server (not
> > > a
> > > front-end) will certainly have "store.exe" running. You can then run a
> > > command
> > > "tasklist" which dumps all the running processes. If instr store.exe, the
> > > computer is a mailbox server. A similar analogy should help with mysql.
> > >
> > > Blue Ice wrote:
> > >
> > >> Actually, I think that I have to send a signal to the computers in the
> > >> network and wait until a computer answers. So when the computer is a
> > >> MySQL
> > >> server, it will tell me that it is a MySQL server.
> > >>
> > >> Arjan.
> > >


Re: Searching for MySQL servers on the network by Blue

Blue
Thu Jun 30 15:49:18 CDT 2005

I think you can get what you want by using WMI -> Win32_Process. It might be
the solution to what you are looking for.

Arjan

"dmsys" <dmsys.nospmcaleb1@ntlworld.com> wrote in message
news:42BFEEFE.32176CF4@ntlworld.com...
> Please remove the quotes from findstr "processX.exe" (etc.)
>
> dmsys wrote:
>
>> No, not a lot of overhead, at least ours is very fast. You could use a
>> simple
>> batch file (.bat) like this, although it could be a lot more elaborate
>> with wsh:
>>
>> tasklist /s server01 > server01.txt
>> tasklist /s server02 > server02.txt
>> tasklist /s server03 > server03.txt
>> rem replace "processX.exe" with your target server's process
>> findstr "processX.exe", server*.txt > svrproc.txt
>> del server*.txt
>> notepad svrproc.txt
>>
>> or you could further refine this elementary method to be more relevant to
>> your
>> needs:
>>
>> tasklist /s server01 > servers.txt
>> tasklist /s server02 >> servers.txt
>> tasklist /s server03 >> servers.txt
>> rem replace "processSQ1.exe" with your target server's process
>> echo ******************** SQ1 processes > svrproc.txt
>> findstr processSQ1.exe, servers.txt > svrproc.txt
>> echo ******************** SQ2 processes >> svrproc.txt
>> rename servers.txt servers2.txt
>> findstr "processSQ2.exe", servers2.txt >> svrproc.txt
>> echo ******************** SQ3 processes >> svrproc.txt
>> rename servers2.txt servers3.txt
>> findstr "processSQ3.exe", servers3.txt >> svrproc.txt
>> echo "" >> svrproc.txt
>> del serv*.txt
>> notepad svrproc.txt
>>
>> Note that if you use IPaddresses instead of hostnames, the script could
>> hang if
>> the server is unavailable.
>> If you need more than the default four columns returned by tasklist, you
>> may
>> have to use wmi. Alternatively, if you find methods to return more than 4
>> columns, or to return specific columns, please post.
>>
>> Regards.
>>
>> Blue Ice wrote:
>>
>> > That might be a good idea, although I am not sure that it runs just one
>> > single process. I believe that there 4 executables that can be used to
>> > start
>> > MySQL and it can be started as a service. However I will investigate
>> > this
>> > idea. By the way, would this create a lot overhead?
>> > Thank you for the idea!
>> >
>> > Arjan.
>> >
>> > "dmsys" <dmsys.caleb1@ntlworld.com> wrote in message
>> > news:42BD14E9.A74297A9@ntlworld.com...
>> > > What process does mysql server execute on the computer? For instance,
>> > > a
>> > > computer running Microsoft Exchange Server _and_ is a mailbox server
>> > > (not
>> > > a
>> > > front-end) will certainly have "store.exe" running. You can then run
>> > > a
>> > > command
>> > > "tasklist" which dumps all the running processes. If instr store.exe,
>> > > the
>> > > computer is a mailbox server. A similar analogy should help with
>> > > mysql.
>> > >
>> > > Blue Ice wrote:
>> > >
>> > >> Actually, I think that I have to send a signal to the computers in
>> > >> the
>> > >> network and wait until a computer answers. So when the computer is a
>> > >> MySQL
>> > >> server, it will tell me that it is a MySQL server.
>> > >>
>> > >> Arjan.
>> > >
>



Re: Searching for MySQL servers on the network by Blue

Blue
Thu Jun 30 17:53:04 CDT 2005

Ok, this is my solution and it seems to work:

'--- Start Script ---
For i = 90 to 120
strIP = "194.152.100." & CStr(i)
Set PingResults =
GetObject("winmgmts:{impersonationLevel=impersonate}//./root/cimv2").ExecQuery("SELECT
* FROM Win32_PingStatus WHERE Address = '" + strIP + "'")
For Each PingResult In PingResults
If PingResult.StatusCode = 0 Then
If LCase(strIP) = PingResult.ProtocolAddress Then
TestComputer(strIP)
End If
Next
Next

Sub TestComputer(strComputer)
Set MySQLProc = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2").ExecQuery("Select * from Win32_Process",,48)
For Each ProcItem in MySQLProc
iProc = InStr(1, ProcItem.Caption, "mysqld", vbtextcompare)
If iProc > 0 Then Wscript.Echo strIP & " - " & GetComputerName(strIP)
Next
End Sub

Function GetComputerName(strCompName)
Set ComputerNames =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strCompName &
"\root\cimv2").ExecQuery("SELECT * FROM Win32_ComputerSystem")
For Each CNItem In ComputerNames
GetComputerName = CNItem.Name
Next
End Function
'--- End Script ---

Thank you all for who helped me out and tried to think with.

Arjan.


"Blue Ice" <noemailaddresstospam@the.newsgroup> wrote in message
news:e7HuwUbfFHA.3252@TK2MSFTNGP10.phx.gbl...
>I think you can get what you want by using WMI -> Win32_Process. It might
>be the solution to what you are looking for.
>
> Arjan
>
> "dmsys" <dmsys.nospmcaleb1@ntlworld.com> wrote in message
> news:42BFEEFE.32176CF4@ntlworld.com...
>> Please remove the quotes from findstr "processX.exe" (etc.)
>>
>> dmsys wrote:
>>
>>> No, not a lot of overhead, at least ours is very fast. You could use a
>>> simple
>>> batch file (.bat) like this, although it could be a lot more elaborate
>>> with wsh:
>>>
>>> tasklist /s server01 > server01.txt
>>> tasklist /s server02 > server02.txt
>>> tasklist /s server03 > server03.txt
>>> rem replace "processX.exe" with your target server's process
>>> findstr "processX.exe", server*.txt > svrproc.txt
>>> del server*.txt
>>> notepad svrproc.txt
>>>
>>> or you could further refine this elementary method to be more relevant
>>> to your
>>> needs:
>>>
>>> tasklist /s server01 > servers.txt
>>> tasklist /s server02 >> servers.txt
>>> tasklist /s server03 >> servers.txt
>>> rem replace "processSQ1.exe" with your target server's process
>>> echo ******************** SQ1 processes > svrproc.txt
>>> findstr processSQ1.exe, servers.txt > svrproc.txt
>>> echo ******************** SQ2 processes >> svrproc.txt
>>> rename servers.txt servers2.txt
>>> findstr "processSQ2.exe", servers2.txt >> svrproc.txt
>>> echo ******************** SQ3 processes >> svrproc.txt
>>> rename servers2.txt servers3.txt
>>> findstr "processSQ3.exe", servers3.txt >> svrproc.txt
>>> echo "" >> svrproc.txt
>>> del serv*.txt
>>> notepad svrproc.txt
>>>
>>> Note that if you use IPaddresses instead of hostnames, the script could
>>> hang if
>>> the server is unavailable.
>>> If you need more than the default four columns returned by tasklist, you
>>> may
>>> have to use wmi. Alternatively, if you find methods to return more than
>>> 4
>>> columns, or to return specific columns, please post.
>>>
>>> Regards.
>>>
>>> Blue Ice wrote:
>>>
>>> > That might be a good idea, although I am not sure that it runs just
>>> > one
>>> > single process. I believe that there 4 executables that can be used to
>>> > start
>>> > MySQL and it can be started as a service. However I will investigate
>>> > this
>>> > idea. By the way, would this create a lot overhead?
>>> > Thank you for the idea!
>>> >
>>> > Arjan.
>>> >
>>> > "dmsys" <dmsys.caleb1@ntlworld.com> wrote in message
>>> > news:42BD14E9.A74297A9@ntlworld.com...
>>> > > What process does mysql server execute on the computer? For
>>> > > instance, a
>>> > > computer running Microsoft Exchange Server _and_ is a mailbox server
>>> > > (not
>>> > > a
>>> > > front-end) will certainly have "store.exe" running. You can then run
>>> > > a
>>> > > command
>>> > > "tasklist" which dumps all the running processes. If instr
>>> > > store.exe, the
>>> > > computer is a mailbox server. A similar analogy should help with
>>> > > mysql.
>>> > >
>>> > > Blue Ice wrote:
>>> > >
>>> > >> Actually, I think that I have to send a signal to the computers in
>>> > >> the
>>> > >> network and wait until a computer answers. So when the computer is
>>> > >> a
>>> > >> MySQL
>>> > >> server, it will tell me that it is a MySQL server.
>>> > >>
>>> > >> Arjan.
>>> > >
>>
>
>