I have a request from my manager to change the static IP address information for a list of 20 or 30 computers. I was trying to figure out how to do it using PowerShell.
So I found a script online that looks like it's what I'm going for but it's got a few bugs and I can't figure them all out.
function Set-DNSWINS { #Get NICS via WMI $NICs = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $_ -Filter "IPEnabled=TRUE" foreach($NIC in $NICs) { $DNSServers = "12.34.5.67","76.54.3.21" $NIC.SetDNSServerSearchOrder($DNSServers) $NIC.SetDynamicDNSRegistration("TRUE") $NIC.SetWINSServer("10.1.4.116", "10.16.5.204") } } function Get-FileName { $computer = Read-Host "Filename of computer names?" return $computer } $f = Get-FileName Get-Content $f | foreach {Set-DNSWINS}It coughs up the prompt and I'm not sure why:
cmdlet Get-WmiObject at command pipeline position 1
Supply values for the following parameters:
Class:
Any help would be greatly appreciated. Thank you
Source: http://www.virtu-al.net/2008/08/22/change-dns-and-wins-on-multiple-servers/
- Edited by Mauricem 16 hours 59 minutes ago Added link