Results 1 to 3 of 3

Thread: how to change default gateway

  1. #1
    tdubb Guest

    how to change default gateway

    Here is my script to change the ip address, mash and default gateway but the
    default gateway is not being changed

    strComputer = "."
    IPAddress = InputBox("Enter IP Address")
    SubnetMask = InputBox("Enter Subnet Mask")
    DefaultGateway = InputBox("Enter Default Gateway")
    arrIPAddress = Array(IPAddress)
    arrSubnetMask = Array(SubnetMask)
    arrDefaultGateway = Array(DefaultGateway)
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colNetAdapters = objWMIService.ExecQuery("Select * from
    Win32_NetworkAdapterConfiguration")
    For Each objNetAdapter in colNetAdapters
    errEnableStatic = objNetAdapter.EnableStatic(arrIPAddress,
    arrSubnetMask, arrDefaultGateway)
    Next

    any idea?



  2. #2
    Pegasus \(MVP\) Guest

    Re: how to change default gateway


    "tdubb" <tdubb123@gmail.com> wrote in message
    news:%23eUPgGGkIHA.3780@TK2MSFTNGP06.phx.gbl...
    > Here is my script to change the ip address, mash and default gateway but
    > the default gateway is not being changed
    >
    > strComputer = "."
    > IPAddress = InputBox("Enter IP Address")
    > SubnetMask = InputBox("Enter Subnet Mask")
    > DefaultGateway = InputBox("Enter Default Gateway")
    > arrIPAddress = Array(IPAddress)
    > arrSubnetMask = Array(SubnetMask)
    > arrDefaultGateway = Array(DefaultGateway)
    > Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    > Set colNetAdapters = objWMIService.ExecQuery("Select * from
    > Win32_NetworkAdapterConfiguration")
    > For Each objNetAdapter in colNetAdapters
    > errEnableStatic = objNetAdapter.EnableStatic(arrIPAddress,
    > arrSubnetMask, arrDefaultGateway)
    > Next
    >
    > any idea?
    >


    This link might help:
    Automating TCP/IP Networking on Clients
    http://www.microsoft.com/technet/scr...tnc_basic.mspx



  3. #3
    Remco Guest

    Re: how to change default gateway

    it's not in the DHCP scope options ??


    "tdubb" <tdubb123@gmail.com> schreef in bericht
    news:%23eUPgGGkIHA.3780@TK2MSFTNGP06.phx.gbl...
    > Here is my script to change the ip address, mash and default gateway but
    > the default gateway is not being changed
    >
    > strComputer = "."
    > IPAddress = InputBox("Enter IP Address")
    > SubnetMask = InputBox("Enter Subnet Mask")
    > DefaultGateway = InputBox("Enter Default Gateway")
    > arrIPAddress = Array(IPAddress)
    > arrSubnetMask = Array(SubnetMask)
    > arrDefaultGateway = Array(DefaultGateway)
    > Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    > Set colNetAdapters = objWMIService.ExecQuery("Select * from
    > Win32_NetworkAdapterConfiguration")
    > For Each objNetAdapter in colNetAdapters
    > errEnableStatic = objNetAdapter.EnableStatic(arrIPAddress,
    > arrSubnetMask, arrDefaultGateway)
    > Next
    >
    > any idea?
    >




Similar Threads

  1. Default gateway unavailable in windows 7
    By LynDa55 in forum Networking & Security
    Replies: 5
    Last Post: 09-12-2010, 11:03 PM
  2. Default Gateway Problem
    By kodiedawg in forum Networking & Security
    Replies: 1
    Last Post: 26-05-2010, 12:38 AM
  3. WHY DOES OUTLOOK 2007 NEED A DEFAULT GATEWAY??????
    By Q Jones in forum Office Setup
    Replies: 2
    Last Post: 08-09-2009, 07:33 AM
  4. Can't get default gateway
    By SamDust in forum Networking & Security
    Replies: 4
    Last Post: 01-07-2009, 11:26 PM
  5. Default Gateway is not available?
    By docmarten in forum Networking & Security
    Replies: 3
    Last Post: 25-03-2009, 11:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •