-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNo WINS.vbs
More file actions
40 lines (36 loc) · 1.12 KB
/
Copy pathNo WINS.vbs
File metadata and controls
40 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Option Explicit
On Error Resume Next
dim sFileName, oFSO, oInputFile, strComputer
dim objWMIService, colAdapters, objAdapter, hostName
const ForReading = 1
sFileName = "clients.txt"
Call CheckCScript
set oFSO = CreateObject("Scripting.FileSystemObject")
set oInputFile = oFSO.OpenTextFile("c:\" & sFileName, ForReading)
If Err.Number <> 0 Then
WScript.Echo "Couldn't Find C:\" & sFileName
WScript.Echo Err.Number
WScript.Quit
End If
Do Until oInputFile.AtEndOfStream
strComputer = oInputFile.Readline
Set objWMIService = GetObject("winmgmts:" & "!\\" & strComputer & "\root\cimv2")
If Err <> 0 Then
Err.Clear
WScript.Echo "Could not contact " & strComputer
Else
Set colAdapters = objWMIService.ExecQuery("Select * from " _
& "Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objAdapter in colAdapters
objAdapter.SetWinsServer "",""
Next
WScript.Echo strComputer & " done."
End If
Loop
Sub CheckCScript
hostname = lcase(right(WSCript.Fullname, 11))
If hostname = "wscript.exe" Then
WScript.Echo "This script requires cscript.exe"
WScript.Quit
End If
End Sub