• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

Sensing NT network connection

Is there a way in VB that I can test to determine whether or not the host system is currently logged onto a network?  (Specifically, NT).
0
harrrj
Asked:
harrrj
1 Solution
 
MirkwoodCommented:
Take a look at this site. It contains kinds of code about  NT including what you want

http://www.netfokus.dk/vbadmincode/codevb.html
0
 
NoCheeseCommented:
Keep in mind that an NT workstation is always logged onto a network, even when it is standalone, it is part of it's own local domain.

If you want to see if a user is logged on to the local machine or an external network such as a domain, is to compare the environment variable %COMPUTERNAME% against %USERDOMAIN%.  If they are the same, the user is logged in with a local account.  If they are different they are logged in to an external domain.

That is just half of the puzzle.  Once you have determined that the user is logged into an external domain, you need to find out if the user was actually validated, or logged in with cached credentials because they are currently disconnected.  Retreive the variable %LOGONSERVER%, append "\NETLOGON" to the end of it, and use that as the server path in the WNetGetUser API.  If the return value is NON "0", then the user is disconeccted.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now