i want know the loginname of user currently logged on windows 2000 server.
or some one please tell me how to get the user name of logged user.
Printable View
i want know the loginname of user currently logged on windows 2000 server.
or some one please tell me how to get the user name of logged user.
Hope this will help, I use it in the workstation to get user login name
VB Code:
Option Explicit Private Declare Function GetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpbuffer As String, _ nSize As Long) As Long Public Function GetLoginName() As String Dim sBuffer As String Dim lSize As Long Dim strHostName As String sBuffer = Space$(255) lSize = Len(sBuffer) Call GetUserName(sBuffer, lSize) If lSize > 0 Then GetLoginName = Left$(sBuffer, lSize) Else GetLoginName = vbNullString End If End Function
Hi ,
one quick way could be executing the command
net config workstation
:)