Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

Visual basic

Estas en el tema de Visual basic en el foro de Visual Basic clásico en Foros del Web. Qhisiaera saber si alguien me podria ayudar con un pequeño problemilla que tengo quiero saber como recuperar los nombre de los usuarios de una red ...
  #1 (permalink)  
Antiguo 17/12/2002, 03:52
 
Fecha de Ingreso: noviembre-2002
Mensajes: 52
Antigüedad: 21 años, 5 meses
Puntos: 0
Visual basic

Qhisiaera saber si alguien me podria ayudar con un pequeño problemilla que tengo

quiero saber como recuperar los nombre de los usuarios de una red en visual basic

gracias por adelantado un saludo
  #2 (permalink)  
Antiguo 17/12/2002, 12:38
Avatar de Jorge_Mota  
Fecha de Ingreso: diciembre-2002
Ubicación: Chapinlandia :-D
Mensajes: 725
Antigüedad: 21 años, 5 meses
Puntos: 11
intenta ver con este codigo


Dim cont As IADsContainer

'Example: Enumerating all local users on member server or workstation
'''''''''''''''''''''''''''''''''''''''
'Parse the arguments
'''''''''''''''''''''''''''''''''''''''
sComputer = InputBox("This script lists the users on a member server or workstation." & vbCrLf & vbCrLf & "Specify the computer name:")

If sComputer = "" Then
Exit Sub
End If

'''''''''''''''''''''''''''''''''''''''
'Bind to the computer
'''''''''''''''''''''''''''''''''''''''
'Note that this sample uses the logged-on user's context
'To specify a user account other than the user account under
'which your application is running, use IADsOpenDSObject.
Set cont = GetObject("WinNT://" & sComputer & ",computer")
If (Err.Number <> 0) Then
BailOnFailure Err.Number, "on GetObject method"
End If

'''''''''''''''''''''''''''''''''''''''
'Filter to view only user objects
'''''''''''''''''''''''''''''''''''''''
cont.Filter = Array("User")
If (Err.Number <> 0) Then
BailOnFailure Err.Number, "on IADsContainer::Filter method"
End If

strText = ""
intIndex = 0
intNumDisplay = 0
cmember = 0
'Maximum number of users to list on a msgbox.
MAX_DISPLAY = 20

'''''''''''''''''''''''''''''''''''''''
'Get each user
'''''''''''''''''''''''''''''''''''''''
For Each user In cont
intIndex = intIndex + 1
'Get the name
strText = strText & vbCrLf & Right(" " & intIndex, 4) & " " & user.Name
intNumDisplay = intNumDisplay + 1
'Display in msgbox if there are MAX_DISPLAY users to display
If intNumDisplay >= MAX_DISPLAY Then
Call show_users(strText, sComputer)
strText = ""
intNumDisplay = 0
End If
'Reset the count of members within the current group
cmember = 0
Next
Call show_users(strText, sComputer)
'''''''''''''''''''''''''''''''''''''''
'Display subroutines
'''''''''''''''''''''''''''''''''''''''
Sub show_users(strText, strName)
MsgBox strText, vbInformation, "Users on " & strName
End Sub

Sub BailOnFailure(ErrNum, ErrText) strText = "Error 0x" & Hex(ErrNum) & " " & ErrText
MsgBox strText, vbInformation, "ADSI Error"
WScript.Quit
End Sub
__________________
Jorge Mota
Blog
Gubiz estafa
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:17.