Results 1 to 4 of 4

Thread: How to set the vbscript setgateway

  1. #1
    Join Date
    Apr 2008
    Posts
    242

    How to set the vbscript setgateway

    I need a script so that I can change the network properties on each workstation. I need to change the DNS properties and WINS servers, I think it can do with vbscript. But i don't know how write. Could someone help me or guide me?

  2. #2
    Join Date
    Oct 2008
    Posts
    115

    Re: How to set the vbscript setgateway

    As for the gateways, you can enumerate them (string DefaultIPGateway[]; property of the class), and set it with the SetGateways method of the same class. All good so far. The problem I found was that you were making the arrIPAddress array larger even if there was no new IP address for it to hold and it didn't like that.

    On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colNetCards = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objNetCard in colNetCards Wscript.Echo objNetCard.SetDNSDomain("fabrikam.com") Next

  3. #3
    Join Date
    Oct 2008
    Posts
    132

    Re: How to set the vbscript setgateway

    I had tried manually with Netsh command to change default gateway setting in TCP/IP properties. Currently, if the link is down, user need to manually run this Netsh batch file to change default gateway. Using vbscript and Sysinternals PSEXEC you can run the NetSH on the remote machines.

  4. #4
    Join Date
    Feb 2008
    Posts
    102

    Re: How to set the vbscript setgateway

    After that their pc can switch to another default gateway. I think it will ok with vbscript for auto ping and change default gateway setting. I have the computer names and IP's in a text file. How can I loop psexec through the names to make the changes?? Anybody now the command? I had tried manually with Netsh command to change default gateway setting in TCP/IP properties.
    Currently, if the link is down, user need to manually run this Netsh batch file to change default gateway. After that their pc can switch to another default gateway.

Similar Threads

  1. VBScript for .NET
    By Bharat89 in forum Software Development
    Replies: 3
    Last Post: 03-12-2009, 04:50 PM
  2. About VBScript Editing
    By Modifier in forum Software Development
    Replies: 2
    Last Post: 02-09-2009, 05:34 PM
  3. help with vbscript
    By andrakis2 in forum Networking & Security
    Replies: 3
    Last Post: 24-08-2009, 06:13 AM
  4. How to use Win32_NetworkAdapterConfiguration in VBScript
    By B_Hodge in forum Networking & Security
    Replies: 3
    Last Post: 06-06-2009, 09:35 PM
  5. How can I add a new line to vbscript?
    By Baani in forum Software Development
    Replies: 2
    Last Post: 29-05-2009, 04:54 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,293,930.09007 seconds with 17 queries