Windows Scripting BLOG

Due to limited time working on this project this place is not intended to people who are new to scripting but much more for people who are already familiar with the VBS/WMI syntax.

Donnerstag, 17. Mai 2007

Script for detecting systems with statically configured IP addresses

On Error Resume NextIN_FILE = Wscript.Arguments(0)
Const PRO_READ = 1Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(IN_FILE, PRO_READ)
strComputers = objFile.ReadAllobjFile.ClosearrComputers = Split(strComputers, vbCrLf)
For Each strComputer In arrComputers
Set wbemServices = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set wbemObjectSet = wbemServices.InstancesOf("Win32_NetworkAdapterConfiguration")
For each wbemObject in wbemObjectSetif wbemObject.DHCPEnabled = false then For T=LBOUND(wbemObject.IPAddress) _
to UBOUND(wbemObject.IPAddress)WScript.Echo "Static IP configured on system: "& strComputer & vbCrLf & _"IP address: "& wbemObject.IPAddress(T)
end if
Next 'created by Julian Ruf

Keine Kommentare: