Get Workstation Name

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

Hi. I am writing a small VB.NET project that will be running as an EXE on XP
(Windows 2003 network) within my organization. It has to pull data from an
SQL Server on the intranet, and in order to do that the path to the local
Access file has to be in UNC format (\\Machine\DriveLetter$\File.mdb).

What is the simplest way in VB.NET to obtain the Active Directory name of
the computer on which the program is executing? Any code appreciated.
 
Ive used

System.AppDomain.CurrentDomain.BaseDirectory()
I believe you can use

Environment.CurrentDirectory

aswell.
 
I would check out the Environment namespace

Environment.MachineName - current machines name
Environment.CurrentDirectory - current directory of the running
process

You could look at System.AppDomain.CurrentDomain aswell.
Hope that helps
 
Jason,
I normally use System.Environment.MachineName.

Hope this helps
Jay
 
As a side note, I used the Environment variable to display a dialog of
computer stats but when it was ran on a windows 98 machine it exploded.
 
Back
Top