Solved

workstation list

Posted on 2001-06-19
6
219 Views
Last Modified: 2010-05-02
how can i get a list of the workstations connected to the same domain i m connected to or if i can change the domain
to get tha stations connected to that domain ? then to add them to a list ...
0
Comment
Question by:raed
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:lyonst
ID: 6205875
Duplicate Question Post ... Please delete one.

Hi,

Try this article ...

Since getting my own home network this summer and playing around with NT Server, I have found many limitations on client/server machines for carrying out simple tasks. The API Viewer does not list any Winndows NT Networking API calls, but they are out there.

I dropped in on Inquiry.com's Ask the NT Pro (LJ Johnshon) to see what they had for VB. I found quite a few examples, along with a few of my own, and I have wrapped them up into an easy to use class module called CNetworkNT.

CNetworkNT exposes eight methods for you to use NT from within your VB apps. These methods include:

AddUser - Adds a new user to the current domain
AddUserToLocal - Adds a new user to the local group
ChangePassword - Changes a password for a user
GetDomains - Lists all the domains on the current network
GetLoggedOnUsers - Returns the state of all users on the network.
GetPrimaryDCName - Returns the Primary Domain Controller computer name
Login - Login a user to the network
SetServerInfo - Sets the comment of a server on the network

http://www.vbsquare.com/articles/ntvb/

Hope it helps.

T.
0
 
LVL 5

Accepted Solution

by:
AndrewDev earned 150 total points
ID: 6205902
Display networked computers in a list box

http://www.freevbcode.com/ShowCode.Asp?ID=554

or if you prefer to Get the Names of All Computers in the Domain Using ADSI/LDAP

Public Function AllComputers() As String()

'PURPOSE:  Gets all Computers for the current domain
'and returns them in a string array, using LDAP

'Requires: ADSI, LDAP provider
'This function tested on Windows 2000 RC2

'RETURNS: String array containing all
'Computers for the current domain

'Requires VB6 because in lower versions
'array cannot be return type for a
'function

'EXAMPLE
'Dim sArray() As String
'Dim iCtr As Integer

'sArray = AllComputers
'For iCtr = 0 To UBound(sArray)
'    Debug.Print sArray(iCtr)
'Next

Dim conn As New ADODB.Connection
Dim rs As ADODB.Recordset
Dim oRoot As IADs
Dim oDomain As IADs
Dim sBase As String
Dim sFilter As String
Dim sDomain As String

Dim sAttribs As String
Dim sDepth As String
Dim sQuery As String
Dim sAns() As String
Dim iElement As Integer

On Error GoTo errhandler:

Set oRoot = GetObject("LDAP://rootDSE")
sDomain = oRoot.Get("defaultNamingContext")
Set oDomain = GetObject("LDAP://" & sDomain)
sBase = "<" & oDomain.ADsPath & ">"
sFilter = "(&(objectCategory=Computer))"
sAttribs = "name"
sDepth = "subTree"

sQuery = sBase & ";" & sFilter & ";" & sAttribs & ";" & sDepth
                   
conn.Open _
  "Data Source=Active Directory Provider;Provider=ADsDSOObject"
 
Set rs = conn.Execute(sQuery)
ReDim sAns(0) As String

With rs
    Do While Not .EOF
        iElement = IIf(sAns(0) = "", 0, iElement + 1)
        ReDim Preserve sAns(iElement) As String
        sAns(iElement) = rs("name")
       .MoveNext
    Loop
End With
AllComputers = sAns

errhandler:

On Error Resume Next
If rs.State <> 0 Then rs.Close
If conn.State <> 0 Then conn.Close
Set rs = Nothing
Set conn = Nothing
Set oRoot = Nothing
Set oDomain = Nothing

End Function
0
 
LVL 5

Expert Comment

by:AndrewDev
ID: 6205908
You might also find these useful

Computer Viewer/Verifier For Windows NT/2000
http://www.freevbcode.com/ShowCode.Asp?ID=1893

Administer NT/2000 Users, Computers, and Domains Using ADSI/WMI
http://www.freevbcode.com/ShowCode.Asp?ID=1896

Hope this helps
Andrew
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 5

Expert Comment

by:Netminder
ID: 6767444
There has been no activity in this question in quite some time, and it looks like it has been abandoned. As part of our ongoing mission to clean up the topic areas, a Moderator will finalize this question within the next seven (7) days. At that time, either I or one of the other Moderators will force/accept the comment of AndrewDev.

DO NOT ACCEPT THIS COMMENT AS AN ANSWER. If you have further comments on this question or the recommendation, please leave them here.

raed,

Some of these questions have been open for some time, and records indicate you logged in as recently as this week. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.

http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20261025
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20253068
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20193883
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20193880
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20193879
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20193268
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20174535
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20137815
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20130736

Thanks,

Netminder
Community Support Moderator
Experts Exchange
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6821421
Force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0
 
LVL 5

Expert Comment

by:AndrewDev
ID: 6821596
Thanks Netminder
Your doing a great job :-)

Andrew
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now