Hi,
How do I get the username that's currently logged in (I want to run a script in VB which will be able to deal with all users and I need the username 4 it).
thanks,
Moshe
Public Declare Function WNetGetUser Lib "mpr" Alias "WNetGetUserA" _
(ByVal x As String, ByVal UserName As String, IBufSz As Long) As Long
Dim BufSz As Long, result As Long, Buffer As String
Dim NullPos As Integer
BufSz = 256
Buffer = String$(BufSz, 0)
result = WNetGetUser("", Buffer, BufSz)
If result = 0 Then
NullPos = InStr(Buffer, Chr(0))
GmsGetUser = Left(Buffer, NullPos - 1)
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.