No announcement yet.

Netsh usage

  • Filter
  • Time
  • Show
Clear All
new posts

  • Netsh usage

    I am familiar with NTSH. So I ahve read the postings on this site.
    If I have missed the answer to my question-I appologize in advance

    I have 15 subnets in 1 AD Domain
    subnet "1" is DHCP
    The other 14 subnets are static
    I wish to run netsh against the 14 static subnets to add multiple DNS entries
    but do not wish to affect the "1" subnet


  • #2
    Re: Netsh usage

    OK, so what is your question?

    BTW - what do you mean by "DNS entries"? The context seems to point to "DNS servers" but the term "entries" is usually used for records.

    Network Consultant/Engineer
    Baltimore - Washington area and beyond


    • #3
      Re: Netsh usage

      Sorry for the confusion-
      within the properies of the "local area connection" need to add a second static address.
      Have used netsh in the past to push to domain- just not to particular subnets

      In reference to my original post-

      "Main" subnet= 172.16.0.X

      "sites" subnets =172.16.2.x
      and soforth

      Just need to set the DNS on the PC's in the particular subnets
      the sites have static addessing

      the main uses DHCP

      Thanks JM


      • #4
        Re: Netsh usage

        JM, you are making this hard...

        I'm going to guess that you want instructions on how you can deploy a .... script maybe? using.... ??? er, maybe you have a Windows server... with perhaps Active Directory?

        The thing is, I have no idea what your setup is and you still haven't asked a question.

        3rd times a charm maybe?

        Network Consultant/Engineer
        Baltimore - Washington area and beyond


        • #5
          Re: Netsh usage

          I'l try again

          I have a 2003 AD with 15 subnets
          The computers are in the built-in OU
          policy is managed by OU's that apply to USERs/not computers

          "Main site" is

          All remote sites are through

          "Main site" clients are enabled for DHCP

          Remote site clients are static assigned IP's

          Each of the clients at the remote sites have

          1.An IP adress
          2.subnet mask
          4. 1 DNS server entry in the DNS tab

          Here is my question.

          How do I add a second DNS entry to all of the remote clients VIA a script (NETSH)
          or GP without adding the entry to the "main site"

          In short-- is there a way to use NETSH against a speficic "pool" of computers?

          thank you



          • #6
            Re: Netsh usage

            Can I ask why you can't modify the GPOs applied to the computers? That would be a handy way of making this change.

            Anyhow for a script you would be best off posting in the scripting section.
            Still a bad try on my part (not using netsh) would look like:

            Option Explicit  
            On Error Resume Next
            Dim objWMIService
            Dim objNetAdapter
            Dim objComputer
            Dim colNetAdapters
            Dim strComputer
            strComputer = "."
            Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
            	Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
            	For Each objNetAdapter in colNetAdapters
            		objNetAdapter.SetDNSServerSearchOrder array("", "") '/************to add in more dns servers just use a , between addresses and enclose each address in quotes*****************/ 
            Just paste the above into notepad and save as a .vbs file. Then slip it into the gpo's of the users who need the change.
            Really though if you want a script the scripting section will do a much much better job then I ever could.
            Last edited by Maebe; 11th October 2007, 23:59. Reason: Changed to be more generic.
            I don't know anything about (you or your) computers.
            Research/test for yourself when listening to free advice.


            • #7
              Re: Netsh usage

              Alright, now we're talking.

              There's a couple of ways (when is there not? ) to do this and it will depend on how your computers are distributed to users.

              One option is to create an OU for all the remote computers and put them in it. Then all you would have to do is:
              - write the script/batch (or use Maebe's)
              - create and link a new GPO to the OU
              - add the script to the Computer Configuration\Windows Settings\Scripts\Startup

              Another way is to create and link a new GPO to the appropriate sites in ADSS (or GPMC if it's installed). That way only computers in the remote sites will get the script.

              There are more ways, like creating groups and filtering which can apply the policy, using psexec to run the command on a specific set of computers, or creating a scheduled task on a specific set of computers.

              BTW - just for reference, the Builtin container is not an OU. Domains, Sites, and OUs are the only containers that can have GPOs linked to them, therefore the Builtin container cannot have a GPO linked to it. However, objects within the Builtin container will apply GPOs linked to the domain or, if applicable, the site (dictated by the subnet of the computer used to logon).

              Network Consultant/Engineer
              Baltimore - Washington area and beyond