//**************************************
//
// Name: Get Logged In User Name
// Description:Gets the name of the user
// logged into a Windows machine on a netwo
// rk.
// By: Darrin Mason
//
//This code is copyrighted and has // limited warranties.Please see http://
// www.1PHPStreet.com/vb/scripts/ShowCode.a
// sp?txtCodeId=1600&lngWId=10 //for details. //**************************************
//
' If you want just the user name, use this code:
Public Function GetUserName() As String
GetUserName = (SystemInformation.UserName.ToString)
' This will return only the user name
End Function
' If you want the domain name included, use the code:
Imports System
Imports System.Security
Public Module SysInfo
Public Function GetUserName() As String
Principal.WindowsIdentity.GetCurrent.Name
' This will return 'domain\username'
End Function
End Module