Netsh WINS Example

Applies To: Windows Server 2008

You can use Netsh commands for Windows Internet Name Service (WINS) in batch files and other scripts to automate tasks. The following batch file example demonstrates how to use Netsh commands for WINS to perform a variety of related tasks.

In this example procedure, WINS-A is a WINS server with the IP address 192.168.125.30 and WINS-B is a WINS server with the IP address 192.168.0.189. The procedure adds a dynamic name record with IP address 192.168.0.205, MY_RECORD [04h], to WINS-A, sets WINS-B as a push/pull replication partner of WINS-A, connects to WINS-B, and then sets WINS-A as a push/pull replication partner of WINS-B. Next, the procedure initiates a push replication from WINS-A to WINS-B, and then connects to WINS-B to verify that the new record, MY_RECORD, was replicated successfully.

In the following example procedure, lines that contain comments are preceded by "rem," for remark. Netsh ignores comments.

rem two WINS servers:
rem (WINS-A) 192.168.125.30
rem (WINS-B) 192.168.0.189

rem 1. Connect to (WINS-A), and add the dynamic name MY_RECORD [04h] to the (WINS-A) database.
netsh wins server 192.168.125.30 add name Name=MY_RECORD EndChar=04 IP={192.168.0.205}

rem 2. Connect to (WINS-A), and set (WINS-B) as a push/pull replication partner of (WINS-A).
netsh wins server 192.168.125.30 add partner Server=192.168.0.189 Type=2

rem 3. Connect to (WINS-B), and set (WINS-A) as a push/pull replication partner of (WINS-B).
netsh wins server 192.168.0.189 add partner Server=192.168.125.30 Type=2

rem 4. Connect back to (WINS-A), and initiate a push replication to (WINS-B).
netsh wins server 192.168.125.30 init push Server=192.168.0.189 PropReq=0

rem 5. Connect to (WINS-B), and check that the record MY_RECORD [04h] was replicated successfully.
netsh wins server 192.168.0.189 show name Name=MY_RECORD EndChar=04

rem 6. End example batch file.

The following table lists the netsh winscommands that are used in this example procedure.

Command Description

server

Shifts the current WINS command-line context to the server specified by either its name or IP address.

add name

Registers a name to the server.

add partner

Adds a replication partner to the server.

init push

Initiates and sends a push trigger to a WINS server.

show name

Displays detailed information for a particular record in the WINS server database.