How to enable/disable network adapter in VB.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: How to enable/disable network adapter in VB.

  1. #1
    Join Date
    Mar 2005
    Posts
    57

    How to enable/disable network adapter in VB.

    Hello guys/gals!

    I'm working an a small scheduling utility for my boss to use on our WinServer. While I'm at it I realized I could add an extra feature to it that I think he would appriciate. He has been Indecisive about weather to shut the server off at night or not. He doesn't like the idea of shutting the server down every night but he also doesn't want to leave it running after work hours with internet vulnerability.

    Simple solution: I could schedule the network adapter to be disabled at 6pm and re-enabled again at 6am or something. That would be perfect!

    I'm sure theirs an API function to do that but I don't know it. I've surfed the web a bit for it but it seems like a close guarded secret (I guess to minimize the threat of sabotage or something). And I understand. But I still need to know.

    Could someone at least point me in the right direction please?
    If you don't want to post that on this forum PM me.



  2. #2
    Join Date
    Mar 2005
    Posts
    57
    Still waiting....

    Please!?

    I'm kind of at a stand still here.

  3. #3
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    I don't know how to disable a network adapter from VB; if I had to do it, I would start by investigating WMI.

    You might also look into the various Windows firewall products (e.g., ZoneAlarm). I believe some of them allow you to close network access at scheduled times.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  4. #4
    Join Date
    Mar 2005
    Posts
    57
    Okay, thank you.

  5. #5
    Join Date
    Nov 2003
    Location
    Sweden
    Posts
    74
    Hi,

    Without having any experience about them, try the functionality of

    WNetCancelConnection()
    WNetAddConnection()

    /Bernie

  6. #6
    Join Date
    Mar 2005
    Posts
    57
    Yea... I'm still stuck on this one. I'll look into those functions and see if they're work. Thanks Bernie.

    Currently I'm doing a search on registry edits. Is there a registry setting that can enable/disable and network adapters? That may be a good way to do it.

  7. #7
    Join Date
    Nov 2003
    Location
    Sweden
    Posts
    74
    To help finding the right registry entries you could download 'Registry Monitor' from http://www.sysinternals.com
    That tool monitors the events in the registry so you can keep track of what happens there when you enable/disable the network driver the ordinary way.

    Similar tools are also availible for monitoring files and ports.

    Bernie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center