Hello everybody,
I am new to dot net and my query is that do we have any built in class for retrieving the user names currently logged in to a network domain. Also how to send a message using VB.net to the users.thanks in advance
Printable View
Hello everybody,
I am new to dot net and my query is that do we have any built in class for retrieving the user names currently logged in to a network domain. Also how to send a message using VB.net to the users.thanks in advance
Hope no body has gone through the same requirement..
public Function GetDomainAccountNames( _
ByVal sDomainName As String) _
As System.Collections.Hashtable
' Parameters: sDomainName - Domain to check
' Returns: Hashtable containing all properties and
' values
Dim MyQuery As Management.ManagementObjectSearcher = _
New Management.ManagementObjectSearcher( _
"SELECT * FROM Win32_Account WHERE Domain='" & _
sDomainName & "'")
Dim MyQueryResults As Management.ManagementObjectCollection = _
MyQuery.Get()
Dim MyObject As Management.ManagementObject
Dim returnTable As New Hashtable()
Dim intcounter As Integer = 0
For Each MyObject In MyQueryResults
returnTable.Add(intcounter, MyObject.Item("Name"))
intcounter = intcounter + 1
Next
Return returnTable
End Function
for sending event message try to use the "Net Send" command.
A big tks