Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 861
  • Last Modified:

wmi set dns server powershell

Hi Guys,

I have this code to define the dns server:

$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'"

$wmi.EnableStatic("10.0.0.15", "255.255.255.0")

$wmi.SetGateways("10.0.0.1", 1)

$wmi.SetDNSServerSearchOrder("10.0.0.100")


However I also need to specify the alternative dns server ideally using powershell,l how can I do this?

thank you in advance.
0
Kelly Garcia
Asked:
Kelly Garcia
1 Solution
 
SteveGTRCommented:
Can you say:

$wmi.SetDNSServerSearchOrder("10.0.0.100", "10.0.0.101")
0
 
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
Try this: (if steveGTR given solution does not work)

$wmi.SetDNSServerSearchOrder(@("10.0.0.100", "10.0.0.101") )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now