I need a script to change the primary DNS and the Secondary DNS for pcs
Windows Professional XP SP2. Do you help me to build it?. I don't have a lot
of idea of VB. Thank you.

Re: Change DNS by Andrew

Andrew
Tue Sep 13 09:11:35 CDT 2005

First off why are you not using DHCP for your workstations?

This is from the Scripting guys (
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )


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
arrDNSServers = Array("192.168.1.100", "192.168.1.200")
objNetCard.SetDNSServerSearchOrder(arrDNSServers)
Next
--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> I need a script to change the primary DNS and the Secondary DNS for pcs
> Windows Professional XP SP2. Do you help me to build it?. I don't have a
lot
> of idea of VB. Thank you.
>
>



Re: Change DNS by camaleon_11

camaleon_11
Tue Sep 13 09:19:44 CDT 2005

Thank you, it has been worth me perfectly. Could one make in the same Script
that first it eliminated the gateway (should not it have) and then to modify
the DNS?. THANK YOU

"Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
First off why are you not using DHCP for your workstations?

This is from the Scripting guys (
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )


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
arrDNSServers = Array("192.168.1.100", "192.168.1.200")
objNetCard.SetDNSServerSearchOrder(arrDNSServers)
Next
--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> I need a script to change the primary DNS and the Secondary DNS for pcs
> Windows Professional XP SP2. Do you help me to build it?. I don't have a
lot
> of idea of VB. Thank you.
>
>




Re: Change DNS by Andrew

Andrew
Tue Sep 13 09:44:22 CDT 2005

Forgive me here but I am having a bit of trouble understanding what you are
asking. Are you asking to eliminate the default gateway?

--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:eCzVy5GuFHA.2592@TK2MSFTNGP09.phx.gbl...
> Thank you, it has been worth me perfectly. Could one make in the same
Script
> that first it eliminated the gateway (should not it have) and then to
modify
> the DNS?. THANK YOU
>
> "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
> news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
> First off why are you not using DHCP for your workstations?
>
> This is from the Scripting guys (
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
>
>
> 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
> arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> objNetCard.SetDNSServerSearchOrder(arrDNSServers)
> Next
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> > I need a script to change the primary DNS and the Secondary DNS for pcs
> > Windows Professional XP SP2. Do you help me to build it?. I don't have a
> lot
> > of idea of VB. Thank you.
> >
> >
>
>
>



Re: Change DNS by camaleon_11

camaleon_11
Tue Sep 13 09:56:18 CDT 2005

I want a script in which the DNS is changed by the one that I want. That
this already Ok thanks to you. But I want that in the same script the
default gateway was eliminated since I use client proxy. And if you already
helped completely me, quisera in the same script to put the IP and the
Subred
Thanks

"Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
news:OYX4iGHuFHA.460@TK2MSFTNGP15.phx.gbl...
Forgive me here but I am having a bit of trouble understanding what you are
asking. Are you asking to eliminate the default gateway?

--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:eCzVy5GuFHA.2592@TK2MSFTNGP09.phx.gbl...
> Thank you, it has been worth me perfectly. Could one make in the same
Script
> that first it eliminated the gateway (should not it have) and then to
modify
> the DNS?. THANK YOU
>
> "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
> news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
> First off why are you not using DHCP for your workstations?
>
> This is from the Scripting guys (
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
>
>
> 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
> arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> objNetCard.SetDNSServerSearchOrder(arrDNSServers)
> Next
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> > I need a script to change the primary DNS and the Secondary DNS for pcs
> > Windows Professional XP SP2. Do you help me to build it?. I don't have a
> lot
> > of idea of VB. Thank you.
> >
> >
>
>
>




Re: Change DNS by Andrew

Andrew
Tue Sep 13 10:10:49 CDT 2005

Do you have a default gateway set already?

--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:ub$MOOHuFHA.600@TK2MSFTNGP10.phx.gbl...
> I want a script in which the DNS is changed by the one that I want. That
> this already Ok thanks to you. But I want that in the same script the
> default gateway was eliminated since I use client proxy. And if you
already
> helped completely me, quisera in the same script to put the IP and the
> Subred
> Thanks
>
> "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
> news:OYX4iGHuFHA.460@TK2MSFTNGP15.phx.gbl...
> Forgive me here but I am having a bit of trouble understanding what you
are
> asking. Are you asking to eliminate the default gateway?
>
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> news:eCzVy5GuFHA.2592@TK2MSFTNGP09.phx.gbl...
> > Thank you, it has been worth me perfectly. Could one make in the same
> Script
> > that first it eliminated the gateway (should not it have) and then to
> modify
> > the DNS?. THANK YOU
> >
> > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
mensaje
> > news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > First off why are you not using DHCP for your workstations?
> >
> > This is from the Scripting guys (
> >
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
> >
> >
> > 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
> > arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> > objNetCard.SetDNSServerSearchOrder(arrDNSServers)
> > Next
> > --
> > Andrew C. Madsen
> > Network Specialist
> > Harley-Davidson Motor Company
> > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> > > I need a script to change the primary DNS and the Secondary DNS for
pcs
> > > Windows Professional XP SP2. Do you help me to build it?. I don't have
a
> > lot
> > > of idea of VB. Thank you.
> > >
> > >
> >
> >
> >
>
>
>



Re: Change DNS by camaleon_11

camaleon_11
Tue Sep 13 10:14:02 CDT 2005

Yes.
I have a script for example:
IP: 172.16.3.9
Subred: 255.255.255.0
Gateway:
DNS: 172.30.0.1
DNS: 172.30.0.2

gateway:
"Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
news:OMHcUVHuFHA.3792@TK2MSFTNGP10.phx.gbl...
Do you have a default gateway set already?

--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:ub$MOOHuFHA.600@TK2MSFTNGP10.phx.gbl...
> I want a script in which the DNS is changed by the one that I want. That
> this already Ok thanks to you. But I want that in the same script the
> default gateway was eliminated since I use client proxy. And if you
already
> helped completely me, quisera in the same script to put the IP and the
> Subred
> Thanks
>
> "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
> news:OYX4iGHuFHA.460@TK2MSFTNGP15.phx.gbl...
> Forgive me here but I am having a bit of trouble understanding what you
are
> asking. Are you asking to eliminate the default gateway?
>
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> news:eCzVy5GuFHA.2592@TK2MSFTNGP09.phx.gbl...
> > Thank you, it has been worth me perfectly. Could one make in the same
> Script
> > that first it eliminated the gateway (should not it have) and then to
> modify
> > the DNS?. THANK YOU
> >
> > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
mensaje
> > news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > First off why are you not using DHCP for your workstations?
> >
> > This is from the Scripting guys (
> >
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
> >
> >
> > 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
> > arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> > objNetCard.SetDNSServerSearchOrder(arrDNSServers)
> > Next
> > --
> > Andrew C. Madsen
> > Network Specialist
> > Harley-Davidson Motor Company
> > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> > > I need a script to change the primary DNS and the Secondary DNS for
pcs
> > > Windows Professional XP SP2. Do you help me to build it?. I don't have
a
> > lot
> > > of idea of VB. Thank you.
> > >
> > >
> >
> >
> >
>
>
>




Re: Change DNS by Andrew

Andrew
Tue Sep 13 10:22:01 CDT 2005

And now you want to put in a default gateway?

--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:OfPWIYHuFHA.4032@TK2MSFTNGP15.phx.gbl...
> Yes.
> I have a script for example:
> IP: 172.16.3.9
> Subred: 255.255.255.0
> Gateway:
> DNS: 172.30.0.1
> DNS: 172.30.0.2
>
> gateway:
> "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
> news:OMHcUVHuFHA.3792@TK2MSFTNGP10.phx.gbl...
> Do you have a default gateway set already?
>
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> news:ub$MOOHuFHA.600@TK2MSFTNGP10.phx.gbl...
> > I want a script in which the DNS is changed by the one that I want. That
> > this already Ok thanks to you. But I want that in the same script the
> > default gateway was eliminated since I use client proxy. And if you
> already
> > helped completely me, quisera in the same script to put the IP and the
> > Subred
> > Thanks
> >
> > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
mensaje
> > news:OYX4iGHuFHA.460@TK2MSFTNGP15.phx.gbl...
> > Forgive me here but I am having a bit of trouble understanding what you
> are
> > asking. Are you asking to eliminate the default gateway?
> >
> > --
> > Andrew C. Madsen
> > Network Specialist
> > Harley-Davidson Motor Company
> > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > news:eCzVy5GuFHA.2592@TK2MSFTNGP09.phx.gbl...
> > > Thank you, it has been worth me perfectly. Could one make in the same
> > Script
> > > that first it eliminated the gateway (should not it have) and then to
> > modify
> > > the DNS?. THANK YOU
> > >
> > > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
> mensaje
> > > news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > > First off why are you not using DHCP for your workstations?
> > >
> > > This is from the Scripting guys (
> > >
> >
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
> > >
> > >
> > > 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
> > > arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> > > objNetCard.SetDNSServerSearchOrder(arrDNSServers)
> > > Next
> > > --
> > > Andrew C. Madsen
> > > Network Specialist
> > > Harley-Davidson Motor Company
> > > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > > news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> > > > I need a script to change the primary DNS and the Secondary DNS for
> pcs
> > > > Windows Professional XP SP2. Do you help me to build it?. I don't
have
> a
> > > lot
> > > > of idea of VB. Thank you.
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>



Re: Change DNS by camaleon_11

camaleon_11
Tue Sep 13 10:24:12 CDT 2005

No.

"Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
news:ewIAlbHuFHA.3864@TK2MSFTNGP12.phx.gbl...
And now you want to put in a default gateway?

--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:OfPWIYHuFHA.4032@TK2MSFTNGP15.phx.gbl...
> Yes.
> I have a script for example:
> IP: 172.16.3.9
> Subred: 255.255.255.0
> Gateway:
> DNS: 172.30.0.1
> DNS: 172.30.0.2
>
> gateway:
> "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
> news:OMHcUVHuFHA.3792@TK2MSFTNGP10.phx.gbl...
> Do you have a default gateway set already?
>
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> news:ub$MOOHuFHA.600@TK2MSFTNGP10.phx.gbl...
> > I want a script in which the DNS is changed by the one that I want. That
> > this already Ok thanks to you. But I want that in the same script the
> > default gateway was eliminated since I use client proxy. And if you
> already
> > helped completely me, quisera in the same script to put the IP and the
> > Subred
> > Thanks
> >
> > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
mensaje
> > news:OYX4iGHuFHA.460@TK2MSFTNGP15.phx.gbl...
> > Forgive me here but I am having a bit of trouble understanding what you
> are
> > asking. Are you asking to eliminate the default gateway?
> >
> > --
> > Andrew C. Madsen
> > Network Specialist
> > Harley-Davidson Motor Company
> > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > news:eCzVy5GuFHA.2592@TK2MSFTNGP09.phx.gbl...
> > > Thank you, it has been worth me perfectly. Could one make in the same
> > Script
> > > that first it eliminated the gateway (should not it have) and then to
> > modify
> > > the DNS?. THANK YOU
> > >
> > > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
> mensaje
> > > news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > > First off why are you not using DHCP for your workstations?
> > >
> > > This is from the Scripting guys (
> > >
> >
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
> > >
> > >
> > > 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
> > > arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> > > objNetCard.SetDNSServerSearchOrder(arrDNSServers)
> > > Next
> > > --
> > > Andrew C. Madsen
> > > Network Specialist
> > > Harley-Davidson Motor Company
> > > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > > news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> > > > I need a script to change the primary DNS and the Secondary DNS for
> pcs
> > > > Windows Professional XP SP2. Do you help me to build it?. I don't
have
> a
> > > lot
> > > > of idea of VB. Thank you.
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>




Re: Change DNS by Andrew

Andrew
Tue Sep 13 10:45:01 CDT 2005

You want to delete the gateway?

--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:Oiv7zdHuFHA.1472@TK2MSFTNGP15.phx.gbl...
> No.
>
> "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
> news:ewIAlbHuFHA.3864@TK2MSFTNGP12.phx.gbl...
> And now you want to put in a default gateway?
>
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> news:OfPWIYHuFHA.4032@TK2MSFTNGP15.phx.gbl...
> > Yes.
> > I have a script for example:
> > IP: 172.16.3.9
> > Subred: 255.255.255.0
> > Gateway:
> > DNS: 172.30.0.1
> > DNS: 172.30.0.2
> >
> > gateway:
> > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
mensaje
> > news:OMHcUVHuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > Do you have a default gateway set already?
> >
> > --
> > Andrew C. Madsen
> > Network Specialist
> > Harley-Davidson Motor Company
> > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > news:ub$MOOHuFHA.600@TK2MSFTNGP10.phx.gbl...
> > > I want a script in which the DNS is changed by the one that I want.
That
> > > this already Ok thanks to you. But I want that in the same script the
> > > default gateway was eliminated since I use client proxy. And if you
> > already
> > > helped completely me, quisera in the same script to put the IP and the
> > > Subred
> > > Thanks
> > >
> > > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
> mensaje
> > > news:OYX4iGHuFHA.460@TK2MSFTNGP15.phx.gbl...
> > > Forgive me here but I am having a bit of trouble understanding what
you
> > are
> > > asking. Are you asking to eliminate the default gateway?
> > >
> > > --
> > > Andrew C. Madsen
> > > Network Specialist
> > > Harley-Davidson Motor Company
> > > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > > news:eCzVy5GuFHA.2592@TK2MSFTNGP09.phx.gbl...
> > > > Thank you, it has been worth me perfectly. Could one make in the
same
> > > Script
> > > > that first it eliminated the gateway (should not it have) and then
to
> > > modify
> > > > the DNS?. THANK YOU
> > > >
> > > > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
> > mensaje
> > > > news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > > > First off why are you not using DHCP for your workstations?
> > > >
> > > > This is from the Scripting guys (
> > > >
> > >
> >
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
> > > >
> > > >
> > > > 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
> > > > arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> > > > objNetCard.SetDNSServerSearchOrder(arrDNSServers)
> > > > Next
> > > > --
> > > > Andrew C. Madsen
> > > > Network Specialist
> > > > Harley-Davidson Motor Company
> > > > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > > > news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> > > > > I need a script to change the primary DNS and the Secondary DNS
for
> > pcs
> > > > > Windows Professional XP SP2. Do you help me to build it?. I don't
> have
> > a
> > > > lot
> > > > > of idea of VB. Thank you.
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>



Re: Change DNS by camaleon_11

camaleon_11
Tue Sep 13 10:50:08 CDT 2005

yes.

"Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
news:O7UgboHuFHA.3452@TK2MSFTNGP14.phx.gbl...
You want to delete the gateway?

--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:Oiv7zdHuFHA.1472@TK2MSFTNGP15.phx.gbl...
> No.
>
> "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
> news:ewIAlbHuFHA.3864@TK2MSFTNGP12.phx.gbl...
> And now you want to put in a default gateway?
>
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> news:OfPWIYHuFHA.4032@TK2MSFTNGP15.phx.gbl...
> > Yes.
> > I have a script for example:
> > IP: 172.16.3.9
> > Subred: 255.255.255.0
> > Gateway:
> > DNS: 172.30.0.1
> > DNS: 172.30.0.2
> >
> > gateway:
> > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
mensaje
> > news:OMHcUVHuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > Do you have a default gateway set already?
> >
> > --
> > Andrew C. Madsen
> > Network Specialist
> > Harley-Davidson Motor Company
> > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > news:ub$MOOHuFHA.600@TK2MSFTNGP10.phx.gbl...
> > > I want a script in which the DNS is changed by the one that I want.
That
> > > this already Ok thanks to you. But I want that in the same script the
> > > default gateway was eliminated since I use client proxy. And if you
> > already
> > > helped completely me, quisera in the same script to put the IP and the
> > > Subred
> > > Thanks
> > >
> > > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
> mensaje
> > > news:OYX4iGHuFHA.460@TK2MSFTNGP15.phx.gbl...
> > > Forgive me here but I am having a bit of trouble understanding what
you
> > are
> > > asking. Are you asking to eliminate the default gateway?
> > >
> > > --
> > > Andrew C. Madsen
> > > Network Specialist
> > > Harley-Davidson Motor Company
> > > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > > news:eCzVy5GuFHA.2592@TK2MSFTNGP09.phx.gbl...
> > > > Thank you, it has been worth me perfectly. Could one make in the
same
> > > Script
> > > > that first it eliminated the gateway (should not it have) and then
to
> > > modify
> > > > the DNS?. THANK YOU
> > > >
> > > > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
> > mensaje
> > > > news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > > > First off why are you not using DHCP for your workstations?
> > > >
> > > > This is from the Scripting guys (
> > > >
> > >
> >
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
> > > >
> > > >
> > > > 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
> > > > arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> > > > objNetCard.SetDNSServerSearchOrder(arrDNSServers)
> > > > Next
> > > > --
> > > > Andrew C. Madsen
> > > > Network Specialist
> > > > Harley-Davidson Motor Company
> > > > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > > > news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> > > > > I need a script to change the primary DNS and the Secondary DNS
for
> > pcs
> > > > > Windows Professional XP SP2. Do you help me to build it?. I don't
> have
> > a
> > > > lot
> > > > > of idea of VB. Thank you.
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>




Re: Change DNS by Andrew

Andrew
Tue Sep 13 13:24:20 CDT 2005

Then try:
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
arrGatewayAddress = Array()
arrGatewayMetric = Array(1)
arrDNSServers = Array("192.168.1.100", "192.168.1.200")
objNetCard.SetDNSServerSearchOrder(arrDNSServers)
objNetCard.SetGateways(arrGatewayAddress, arrGatewayMetric)
Next

This will set the DNS to your address and blow away the default gateway. If
you want to put in a different gateway you would put the address in quotes
in the array.

Help on this one came from :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__networking.asp


--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
"camaleon_11" <camaleon_11@hotmail.com> wrote in message
news:u917UsHuFHA.3776@TK2MSFTNGP10.phx.gbl...
> yes.
>
> "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el mensaje
> news:O7UgboHuFHA.3452@TK2MSFTNGP14.phx.gbl...
> You want to delete the gateway?
>
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> news:Oiv7zdHuFHA.1472@TK2MSFTNGP15.phx.gbl...
> > No.
> >
> > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
mensaje
> > news:ewIAlbHuFHA.3864@TK2MSFTNGP12.phx.gbl...
> > And now you want to put in a default gateway?
> >
> > --
> > Andrew C. Madsen
> > Network Specialist
> > Harley-Davidson Motor Company
> > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > news:OfPWIYHuFHA.4032@TK2MSFTNGP15.phx.gbl...
> > > Yes.
> > > I have a script for example:
> > > IP: 172.16.3.9
> > > Subred: 255.255.255.0
> > > Gateway:
> > > DNS: 172.30.0.1
> > > DNS: 172.30.0.2
> > >
> > > gateway:
> > > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
> mensaje
> > > news:OMHcUVHuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > > Do you have a default gateway set already?
> > >
> > > --
> > > Andrew C. Madsen
> > > Network Specialist
> > > Harley-Davidson Motor Company
> > > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > > news:ub$MOOHuFHA.600@TK2MSFTNGP10.phx.gbl...
> > > > I want a script in which the DNS is changed by the one that I want.
> That
> > > > this already Ok thanks to you. But I want that in the same script
the
> > > > default gateway was eliminated since I use client proxy. And if you
> > > already
> > > > helped completely me, quisera in the same script to put the IP and
the
> > > > Subred
> > > > Thanks
> > > >
> > > > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
> > mensaje
> > > > news:OYX4iGHuFHA.460@TK2MSFTNGP15.phx.gbl...
> > > > Forgive me here but I am having a bit of trouble understanding what
> you
> > > are
> > > > asking. Are you asking to eliminate the default gateway?
> > > >
> > > > --
> > > > Andrew C. Madsen
> > > > Network Specialist
> > > > Harley-Davidson Motor Company
> > > > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > > > news:eCzVy5GuFHA.2592@TK2MSFTNGP09.phx.gbl...
> > > > > Thank you, it has been worth me perfectly. Could one make in the
> same
> > > > Script
> > > > > that first it eliminated the gateway (should not it have) and then
> to
> > > > modify
> > > > > the DNS?. THANK YOU
> > > > >
> > > > > "Andrew Madsen" <andrew.madsen@harley-davidson.com> escribió en el
> > > mensaje
> > > > > news:e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl...
> > > > > First off why are you not using DHCP for your workstations?
> > > > >
> > > > > This is from the Scripting guys (
> > > > >
> > > >
> > >
> >
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
> > > > >
> > > > >
> > > > > 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
> > > > > arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> > > > > objNetCard.SetDNSServerSearchOrder(arrDNSServers)
> > > > > Next
> > > > > --
> > > > > Andrew C. Madsen
> > > > > Network Specialist
> > > > > Harley-Davidson Motor Company
> > > > > "camaleon_11" <camaleon_11@hotmail.com> wrote in message
> > > > > news:usFvhqGuFHA.3068@TK2MSFTNGP14.phx.gbl...
> > > > > > I need a script to change the primary DNS and the Secondary DNS
> for
> > > pcs
> > > > > > Windows Professional XP SP2. Do you help me to build it?. I
don't
> > have
> > > a
> > > > > lot
> > > > > > of idea of VB. Thank you.
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>



Re: Change DNS by Thomas

Thomas
Tue Sep 13 12:33:10 CDT 2005

In message <e2wUO0GuFHA.3792@TK2MSFTNGP10.phx.gbl>, Andrew Madsen
<andrew.madsen@harley-davidson.com> writes
>First off why are you not using DHCP for your workstations?
>
>This is from the Scripting guys (
>http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0425.mspx )
>
>
>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
> arrDNSServers = Array("192.168.1.100", "192.168.1.200")
> objNetCard.SetDNSServerSearchOrder(arrDNSServers)
>Next

Trying to do this in MSH is a challenge!

$colNetCards= gwo Win32_networkAdapterConfiguration | where
{$_.IPenabled}

But MSH does not expose a method SetDnsServerSearchOrder. There is a
DNSServerSearchOrder property - but there is only a get method, no set
method:


[C:\]: $wmi[1] | gm


TypeName:
System.Management.ManagementObject#root\cimv2\Win32_NetworkAdapterConfigu
ration

Name MemberType Definition
...
DNSServerSearchOrder Property System.String[]
DNSServerSearchOrder {get;}

So I can't figure out a way to simply do this with MSH and WMI.


Thomas
--
Thomas Lee
doctordns@gmail.com
RD - Europe
MVP - Admin Frameworks and Security

Re: Change DNS by Marcel

Marcel
Tue Sep 13 19:51:00 CDT 2005

Unfortunately the MSH WMI adapter doesn't yet expose the methods on the WMI
object. However, you can still invoke the methods via the InvokeMethod
method (Pardon the redundancy) on the WMI object. Here's how to do it (Mind
you, its a bit akward because the WMI method takes an array):


MSH>$colNetCards= get-wmiobject Win32_networkAdapterConfiguration | where
{$_.IPenabled}
MSH>$arrayOfDNSServers = ,("192.168.1.100", "192.168.1.200")
MSH>$colNetCards.InvokeMethod("SetDNSServerSearchOrder", $arrayOfDNSServers)
0
MSH>

Take special note of the comma before the parentheses on the second line.
Its neccesar