How to use VBS for netsh

Written by kevin walker
  • Share
  • Tweet
  • Share
  • Email

Netsh, or net shell, is a powerful administration tool used by systems administrators to quickly and easily modify the network configuration of a server or network, while Visual Basic Script (VBS) is a powerful scripting language designed to automate tasks on a Windows computer. Combined, they make a powerful time-saving device for administrators who need to perform the same command repeatedly on different computers and at different times.

Skill level:
Easy

Other People Are Reading

Instructions

  1. 1

    Open a text editor.

  2. 2

    Paste the following into your text editor:

    set oShell = WScript.CreateObject("WScript.shell")

    This initialises a shell for your script that can be used to run other applications.

  3. 3

    Paste the following command immediately afterward:

    oShell.run "command.com /c netsh -c interface dump > interfaces.txt"

    This will save all the network interface configuration details to the file "interfaces.txt." Altnernatively, you might try this:

    oShell.run "command.com /c netsh firewall set opmode disable"

    As you might guess, this disables the firewall on the computer. It can be re-enabled by using the same command with "disable" replaced with "enable."

Tips and warnings

  • Nearly any task of network configuration can be automated by calling Netsh from Visual Basic Script.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.