
13/05/2006, 07:13
|
 | | | Fecha de Ingreso: agosto-2004
Mensajes: 15
Antigüedad: 20 años, 7 meses Puntos: 0 | |
Hola Señores ya encontre como hacerlo Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dim PC, PcList() As String
'Dim p As String
'PcList = GetDomList("DMRICA")
GetDomList("DMRICA")
'For Each PC In PcList
' ' do something
' p = PC = " & PC)"
'Next
End Sub
Function GetDomList(ByVal domain As String) As String()
Dim dirs, dir As DirectoryEntry
Dim buf(-1) As String
Dim ans As New StringCollection
tvComputadoras.Nodes.Clear()
tvComputadoras.Nodes.Add(New TreeNode(domain, 10, 10))
dirs = New DirectoryEntry("WinNT://" & domain)
For Each dir In dirs.Children
' collect data on all of our Domain PCs
If dir.SchemaClassName = "Computer" Then
ans.Add(dir.Name)
tvComputadoras.Nodes(0).Nodes.Add(New TreeNode(dir.Name, 11, 11))
End If
Next
tvComputadoras.SelectedNode = tvComputadoras.Nodes(0)
tvComputadoras.Nodes(0).Expand()
If ans.Count > 0 Then
ReDim buf(ans.Count - 1)
ans.CopyTo(buf, 0)
End If
Return buf
End Function |