How to Get/Find your Computer/machine Name is easy using simple line of code,
Response.Write("My Computer Name: " + System.Environment.MachineName);
The .NET Framework allows developers to use the same set of skills to rapidly buid great applications for the web, windows, services and more.
Extract Domain Name and User Name
If you want to extract Domain name and User name you can use below code,
Dim strDomain As String
'Extract domain name and username
strDomain = System.Security.Principal.WindowsIdentity.GetCurrent.Name
MsgBox(strDomain)
'Extract domain name from full login
strDomain = Mid(strDomain, 1, InStr(strDomain, "\") - 1)
MsgBox(strDomain)
Dim strDomain As String
'Extract domain name and username
strDomain = System.Security.Principal.WindowsIdentity.GetCurrent.Name
MsgBox(strDomain)
'Extract domain name from full login
strDomain = Mid(strDomain, 1, InStr(strDomain, "\") - 1)
MsgBox(strDomain)
Subscribe to:
Posts (Atom)