Freigeben über


Windows 2012 Core Survival Guide – WINS Client configuration

Learn about my 2012 Core Survival Guide here.

WINS Client configuration

WINS still exist out there in the real world.  For that reason I am including it in this blog series.  PowerShell 3.0 does not have any new cmdlet for configuring WINS server settings.  So I have to drop back to using WMI to accomplish this.  Your WINS sever settings can be provided by your DHCP server or by manual configuration.  If your WINS server settings are provided by DHCP and are incorrect then fix the DHCP scope.  If they have been manually set and are incorrect then keep reading.

Viewing WINS Client configuration

WINS is a legacy component of networking.   I must use the WMI object win32_networkadapterconfiguration in order to retrieve this information.  

PowerShell Command:

Get-WmiObject win32_networkadapterconfiguration | where ipenabled -eq true | format-table index, description, ipaddress, winsprimaryserver, winssecondaryserver -autosize

This command uses the WMI component Win32_Networkadapterconfiguration to view the WINS information.  The output is a bit much.  I have to run 3 commands to ensure I am working with the correct NIC.  I first had to list out the basic IPv4 information.  Then I needed to determine if I was dealing with a DHCP or manual configuration.  Finally I ran the WMI call.   I needed to map the IP address to the correct “index” value.  If you notice the interfaceindex of the cmdlets does not match the index value of the WMI call.

 

Setting WINS Client configuration

I need know the index of the interface I wish to work with.  In the above case it is 13.  I need to use 2 PowerShell command to keep this simple.  The first command get the object I want to work with.  The second command set the values of the WINS Servers.

PowerShell Command:

$WINS = Get-WmiObject win32_networkadapterconfiguration | where index -eq 13

$WINS.SetWINSServer("192.168.0.10","192.168.0.11")

In the output below we have 4 commands. The first one simply displays the interfaces so that you can choose which one to work with.  The next two modifies the WINS client server settings.  The last one simply displays the information again to confirm the work.

 

Removing WINS Client configuration

Once again I must know the index of the interface I wish to work with.  This is the same process as setting the WINS server value.  But in this case I am setting it to $Null.

PowerShell Command:

$WINS = Get-WmiObject win32_networkadapterconfiguration | where index -eq 13

$WINS.SetWINSServer("$Null","$Null")

In the output below I used 4 commands. The first one simply displays the interfaces so I can choose which one to work with.  The next two removes the WINS client server settings.  The last one displays the information to confirm the work.

 

 

I hope you found this useful. Please leave me a comment

Bruce

Comments

  • Anonymous
    January 01, 2003
    I'm glad you found it useful!  Bruce

  • Anonymous
    February 13, 2013
    This certainly saved me some time.  Thanks!

  • Anonymous
    September 13, 2015
    Great script. I would like to run against a number of servers listed in a text file. Can you help?