Locked VB - how to emulate the netsh dos command?

  • Monday, April 24, 2006 6:29 PM
     
     

     

    I am new to Visual Basic although I used to do some programing a while back. I want to write a small app that changes the IP address from DHCP to a set ip/submask and then back to DHCP. I can do this with a DOS batch file using the following command.

    netsh interface ip set address local static 192.168.1.99

    and

    netsh interface ip set address local dhcp

    what would be the syntax in VB2005 to do this?

     

    TIA,

     

All Replies

  • Tuesday, April 25, 2006 2:40 PM
    Moderator
     
     Answered
    You have to use IPHelperAPIs.
    There is no managed equivalent. We have managed APIs to read the
    network information but there are no managed APIs to write the network information.
  • Tuesday, April 25, 2006 9:04 PM
    Moderator
     
     Answered

    You could also use the class System.Diagnostics.Process to run the command as if you were on the command line. 

    If I were looking for a reliable way to do it, I would go with Durga's suggestion.  If you are looking for a simple way to do it, go with mine...

  • Saturday, May 24, 2008 9:59 PM
     
     
    Very disappointing - network interface configuration is some of the most basic work and administrator would like to automate. 

     

  • Sunday, May 25, 2008 1:14 PM
     
     

    Process.Start()