Getting collections of domains/workgroups etc. 
Author Message
 Getting collections of domains/workgroups etc.

Hi everyone!

I would like to make a VB-program, which browses the LAN for
workgroups/domains, computers & shares, and writes results to DB. The
network would be mix of Windows 3.x to 2000-machines and Linux'es with samba
clients, so the code should be compatible with "all kinds" of computers.
(like the network neighberhood)

Three steps (the most important ones...) are still a mystery to me, so if
you can help with any of them I would be very gratefull.

1) a collection (or a simple array with just names of them) of workgroups &
domains within LAN

2) a collection of computers in specified workgroup/domain.

3) and finally a collections of shares of a specified computer.

I managed to make a simple workgroup-browser-function (step 2), but it
didn't work that well (didn't find all the computers), and finally I also
lost the source of that one... :(

Thank you in advance,
Jukka



Sun, 09 Mar 2003 03:00:00 GMT  
 Getting collections of domains/workgroups etc.

Hi,

Be sure to include Microsoft WMI Scripting 1.1 Library  reference in your
project.

'=============code start
Public Sub GetGroups()
Dim objs As WbemScripting.SWbemObjectSet
Dim obj As WbemScripting.SWbemObject
    Set objs = GetObject("winmgmts:").ExecQuery("SELECT * FROM Win32_Group")
    For Each obj In objs
        Debug.Print obj.Name & " on " & obj.Domain & IIf(0 =
Len(obj.Description), Null, " as : " & obj.Description)
    Next obj
End Sub
'===============code end

Hoping it may help,
Vanderghast, Access MPV


Quote:
> Hi everyone!

> I would like to make a VB-program, which browses the LAN for
> workgroups/domains, computers & shares, and writes results to DB. The
> network would be mix of Windows 3.x to 2000-machines and Linux'es with
samba
> clients, so the code should be compatible with "all kinds" of computers.
> (like the network neighberhood)

> Three steps (the most important ones...) are still a mystery to me, so if
> you can help with any of them I would be very gratefull.

> 1) a collection (or a simple array with just names of them) of workgroups
&
> domains within LAN

> 2) a collection of computers in specified workgroup/domain.

> 3) and finally a collections of shares of a specified computer.

> I managed to make a simple workgroup-browser-function (step 2), but it
> didn't work that well (didn't find all the computers), and finally I also
> lost the source of that one... :(

> Thank you in advance,
> Jukka



Mon, 10 Mar 2003 03:00:00 GMT  
 Getting collections of domains/workgroups etc.
Hi again,

Quote:

> > I would like to make a VB-program, which browses the LAN for
> > workgroups/domains, computers & shares, and writes results to DB. The
> > network would be mix of Windows 3.x to 2000-machines and Linux'es with
> samba
> > clients, so the code should be compatible with "all kinds" of computers.
> > (like the network neighberhood)

I need those workgroups/domains, computers & shares. Your nice program
returned usergroups from my local machine. (at least on Windows 2000 Server)

Anyway, my interest in this WMI Scripting reference started to grow...
especially the SQL-like query "SELECT * FROM Win32_Group"...

Is there a source in internet to see what else could be gained like this
from "winmgmts:" or other objects? You have mentioned at least "tables"
"Win32_NetworkAdapter" and "Win32_UserAccount" in this newsgroup.... Are
those really like SQL-tables?

-Jukka


Quote:

> Hi,

> Be sure to include Microsoft WMI Scripting 1.1 Library  reference in your
> project.

> '=============code start
> Public Sub GetGroups()
> Dim objs As WbemScripting.SWbemObjectSet
> Dim obj As WbemScripting.SWbemObject
>     Set objs = GetObject("winmgmts:").ExecQuery("SELECT * FROM
Win32_Group")
>     For Each obj In objs
>         Debug.Print obj.Name & " on " & obj.Domain & IIf(0 =
> Len(obj.Description), Null, " as : " & obj.Description)
>     Next obj
> End Sub
> '===============code end

> Hoping it may help,
> Vanderghast, Access MPV



> > Hi everyone!



Mon, 10 Mar 2003 03:00:00 GMT  
 Getting collections of domains/workgroups etc.

Hi,

Oupse, I didn't thought about "ex-cathedra" OS but if they are somehow
"mapped" in the Active Directory, I suspect that somehow they can be
retrieved, from an app turning under Windows (WMI, Windows Management
Interface,  is the WBEM, Web Base Enterprise Management, as implemented by
Microsoft)

Check http://msdn.microsoft.com/downloads/sdks/wmi/default.asp

You NEED the help file to do something, since classes are created
dynamically, from the SELECT statement (imply no intellisence, no browser):
each field name in the field list become a property in the obj objects; you
can use WHERE fieldname to limit the "collection-recordset", but the HELP
file is required to list the FROM sources available, to specify the
available fields name, their meaning, if they can be updated or not, etc.
Furthermore, yes,, it seems that you can reach those "tables" with MS Access
(the application) using link tables through ODBC. I assume there is a way to
reach them through ADO, but I didn't spotted the information yet (I am too,
a "novice" to this WMI thing, it is just  ... deviant.... )

There is also an article in VBPJ (September 2000), great to start up...
There is a more classical approach too, no SELECT statement like in SQL, but
that requires more code (and doesn't impress as much as the SELECT statement
:-) ).

With the right permission, you can access remote ("in -cathedra")  PC too.
Just play with the moniker   (it is COM+ stuff) like GetObject(  "winmgmts:"
& "//" & strServerName).  Try it on "table" Win32_Process, get the "fields"
ProcessID and Name  with a W2000 something PC as strServerName (you are
logged as network admin or have the required permissions on that remote PC).
That's all so "simple"... just four or five minor modifications to the given
code and there the list of applications actually running on that remote
PC... that's crazy.

Vanderghast, Access MVP


Quote:
> Hi again,


> > > I would like to make a VB-program, which browses the LAN for
> > > workgroups/domains, computers & shares, and writes results to DB. The
> > > network would be mix of Windows 3.x to 2000-machines and Linux'es with
> > samba
> > > clients, so the code should be compatible with "all kinds" of
computers.
> > > (like the network neighberhood)

> I need those workgroups/domains, computers & shares. Your nice program
> returned usergroups from my local machine. (at least on Windows 2000
Server)

> Anyway, my interest in this WMI Scripting reference started to grow...
> especially the SQL-like query "SELECT * FROM Win32_Group"...

> Is there a source in internet to see what else could be gained like this
> from "winmgmts:" or other objects? You have mentioned at least "tables"
> "Win32_NetworkAdapter" and "Win32_UserAccount" in this newsgroup.... Are
> those really like SQL-tables?

> -Jukka



> > Hi,

> > Be sure to include Microsoft WMI Scripting 1.1 Library  reference in
your
> > project.

> > '=============code start
> > Public Sub GetGroups()
> > Dim objs As WbemScripting.SWbemObjectSet
> > Dim obj As WbemScripting.SWbemObject
> >     Set objs = GetObject("winmgmts:").ExecQuery("SELECT * FROM
> Win32_Group")
> >     For Each obj In objs
> >         Debug.Print obj.Name & " on " & obj.Domain & IIf(0 =
> > Len(obj.Description), Null, " as : " & obj.Description)
> >     Next obj
> > End Sub
> > '===============code end

> > Hoping it may help,
> > Vanderghast, Access MPV



> > > Hi everyone!



Mon, 10 Mar 2003 03:00:00 GMT  
 Getting collections of domains/workgroups etc.

Have a look at my WNetResources sample and class on my Classes web page.

--
Monte Hansen
http://KillerVB.com


Quote:
> Hi everyone!

> I would like to make a VB-program, which browses the LAN for
> workgroups/domains, computers & shares, and writes results to DB. The
> network would be mix of Windows 3.x to 2000-machines and Linux'es with
samba
> clients, so the code should be compatible with "all kinds" of computers.
> (like the network neighberhood)

> Three steps (the most important ones...) are still a mystery to me, so if
> you can help with any of them I would be very gratefull.

> 1) a collection (or a simple array with just names of them) of workgroups
&
> domains within LAN

> 2) a collection of computers in specified workgroup/domain.

> 3) and finally a collections of shares of a specified computer.

> I managed to make a simple workgroup-browser-function (step 2), but it
> didn't work that well (didn't find all the computers), and finally I also
> lost the source of that one... :(

> Thank you in advance,
> Jukka



Mon, 10 Mar 2003 03:00:00 GMT  
 Getting collections of domains/workgroups etc.
Seems to be nice program... one thing came to my mind,

can I solve the ip-address and/or dns-name of the remote computer
somehow/easily same time as other information?

-Jukka


Quote:
> This is a part from a app. which I use to search network for certain
files.
> I have modified it a bit so as to list all the Domains, Machines, Shares
> connected on the network. Just call SearchNetworkForFile procedure without
> any parameters, it will create a properly indented log file. Now its upto
> you how to use this code for your purposes :)


> >Hi everyone!

> >I would like to make a VB-program, which browses the LAN for
> >workgroups/domains, computers & shares, and writes results to DB. The
> >network would be mix of Windows 3.x to 2000-machines and Linux'es with
> samba
> >clients, so the code should be compatible with "all kinds" of computers.
> >(like the network neighberhood)

> >Three steps (the most important ones...) are still a mystery to me, so if
> >you can help with any of them I would be very gratefull.

> >1) a collection (or a simple array with just names of them) of workgroups
&
> >domains within LAN

> >2) a collection of computers in specified workgroup/domain.

> >3) and finally a collections of shares of a specified computer.

> >I managed to make a simple workgroup-browser-function (step 2), but it
> >didn't work that well (didn't find all the computers), and finally I also
> >lost the source of that one... :(

> >Thank you in advance,
> >Jukka



Wed, 12 Mar 2003 03:00:00 GMT  
 Getting collections of domains/workgroups etc.
For IP addresses you should use winsock on the side I guess. You should look
at  gethostbyname at gethostbyaddr winsock functions to do this.

Quote:

>Seems to be nice program... one thing came to my mind,

>can I solve the ip-address and/or dns-name of the remote computer
>somehow/easily same time as other information?

>-Jukka



>> This is a part from a app. which I use to search network for certain
>files.
>> I have modified it a bit so as to list all the Domains, Machines, Shares
>> connected on the network. Just call SearchNetworkForFile procedure
without
>> any parameters, it will create a properly indented log file. Now its upto
>> you how to use this code for your purposes :)


>> >Hi everyone!

>> >I would like to make a VB-program, which browses the LAN for
>> >workgroups/domains, computers & shares, and writes results to DB. The
>> >network would be mix of Windows 3.x to 2000-machines and Linux'es with
>> samba
>> >clients, so the code should be compatible with "all kinds" of computers.
>> >(like the network neighberhood)

>> >Three steps (the most important ones...) are still a mystery to me, so
if
>> >you can help with any of them I would be very gratefull.

>> >1) a collection (or a simple array with just names of them) of
workgroups
>&
>> >domains within LAN

>> >2) a collection of computers in specified workgroup/domain.

>> >3) and finally a collections of shares of a specified computer.

>> >I managed to make a simple workgroup-browser-function (step 2), but it
>> >didn't work that well (didn't find all the computers), and finally I
also
>> >lost the source of that one... :(

>> >Thank you in advance,
>> >Jukka



Thu, 13 Mar 2003 12:56:36 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Getting current workgroup or domain name

2. domain pruefen domain provider es domain registrieren domain angebot no domain

3. Getting domain name of parent domain

4. Enumerate Workgroups AND Domains

5. Listing domain and workgroup PC nodes available

6. Domain-name and/or Workgroup info

7. Computers in workgroup/domain/subnet

8. retrieving computername and domains/workgroups

9. API calls for retrieving all the Workgroup/Domain/Computer names on the network

10. Get workgroup or domain name

11. Get workgroup or domain name

12. Get workgroup or domain name

 

 
Powered by phpBB® Forum Software