getting computer and domain name of pc

  • Thread starter Thread starter Jeff Hamilton
  • Start date Start date
J

Jeff Hamilton

Is there a way to retrieve the full computer name
(ComputerName.DomainName.com) using the .Net Framework?
System.Environment.MachineName will return the computer
name but not the domain name.
 
Hello Jeff,

Thanks for your post. We can call the API GetComputerNameEx() with the type
ComputerNameDnsFullyQualified to get the full computer name.

GetComputerNameEx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/bas
e/getcomputernameex.asp

If the application is C#, VB .NET managed application, you can use P/Invoke
to call this Win32 API:

Consuming Unmanaged DLL Functions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconconsumingunmanageddllfunctions.asp

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top