Function Get User Login Fullname from Network

 

Function GetFullName()

Dim WSHnet, objUser, UserName, UserDomain

    Set WSHnet = CreateObject(“WScript.Network”)

   UserName = WSHnet.UserName

   UserDomain = WSHnet.UserDomain

   Set objUser = GetObject(“WinNT://” & UserDomain & “/” & UserName & “,user”)

   GetFullName = objUser.FullName

End Function

===================================

Dim mySQL As String

Dim myUserName, myPC

 

Get UserID logged in

myUserName = Environ$(“username”)

 

Get PC name for User logged in

myPC = Environ$(“computername”)

Related posts