Get Workstation Name

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.
 
N

Not Aaron

Ive used

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

Environment.CurrentDirectory

aswell.
 
N

Not Aaron

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
 
J

Jay B. Harlow [MVP - Outlook]

Jason,
I normally use System.Environment.MachineName.

Hope this helps
Jay
 
N

Not Aaron

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top