Solved

workstation list

Posted on 2001-06-19
6
224 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 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