strIPSubnet = «192.168.0.»

Set objShell = CreateObject(«WScript.Shell»)

On Error Resume Next
For strIPNode = 1 To 254

    strComputer = strIPSubnet & strIPNode

    Set objScriptExec = objShell.Exec(«ping -n 2 -w 1000 « & strComputer)
    strPingStdOut = LCase(objScriptExec.StdOut.ReadAll)

    If InStr(strPingStdOut, «reply from « & strComputer) 
Then
    Set objWMIService = GetObject(«winmgmts:» & _
		«{impersonationLevel=Impersonate}!» & _
		strComputer & «
ootcimv2»)
    If Err.Number <> 0 Then
	WScript.Echo strComputer & «: « & Err.Description
	Err.Clear
    Else
	Set colServices = objWMIService.ExecQuery _
		(«SELECT * FROM Win32_Service WHERE Name=?tlntsvr?»)
	If colServices.Count = 0 Then
		WScript.Echo strComputer & «: Telnet not installed.»
	Else
		For Each objService In colServices
	                           WScript.Echo objService.SystemName & «: « & _
		                	   objService.StartMode  & «,»  & _
			   objService.State
		Next
	End If
	End If
    Else
	 WScript.Echo strComputer & «: Host unreachable»
    End If
Next