Hi,
How can we create a device collection based on only online machines , than use that collection to install the sccm client through client push method.
Technology Tips and News
Hi,
How can we create a device collection based on only online machines , than use that collection to install the sccm client through client push method.
You can run a ping report and then create a collection from only the online machines:
Ping Report Script (Put the machine list in "pclist.txt" in the same folder):
--------------------------------------------------
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
If not objFSO.FileExists("Pclist.txt") THEN
wscript.echo "File not found,"&_
vbcrlf&"with a hard return at the end of each line."
wscript.quit
end if
tempobj="temp.txt"
Set objTextFile = objFSO.OpenTextFile("Pclist.txt", ForReading)
logfile="results.csv"
Set ofile=objFSO.CreateTextFile(logfile,True)
strText = objTextFile.ReadAll
objTextFile.Close
wscript.echo "Ping starting"
ofile.WriteLine ","&"Ping Report -- Date: " & Now() & vbCrLf
arrComputers = Split(strText, vbCrLF)
for each item in arrcomputers
objShell.Run "cmd /c ping -n 1 -w 1200 " & item & " >temp.txt", 0, True
Set tempfile = objFSO.OpenTextFile(tempobj,ForReading)
Do Until tempfile.AtEndOfStream
temp=tempfile.readall
striploc = InStr(temp,"[")
If striploc=0 Then
strip=""
Else
strip=Mid(temp,striploc,16)
strip=Replace(strip,"[","")
strip=Replace(strip,"]","")
strip=Replace(strip,"w"," ")
strip=Replace(strip," ","")
End If
If InStr(temp, "Reply from") Then
ofile.writeline item & ","&strip&","&"Online."
ElseIf InStr(temp, "Request timed out.") Then
ofile.writeline item &","&strip&","&"No response (Offline)."
ELSEIf InStr(temp, "try again") Then
ofile.writeline item & ","&strip&","&"Unknown host (no DNS entry)."
End If
Loop
Next
tempfile.close
objfso.deletefile(tempobj)
ofile.writeline
ofile.writeline ","&"Ping complete "&now()
wscript.echo "completed."
objShell.Run("""C:\Program Files\Microsoft Office\OFFICE11\excel.exe """&logfile)
------------------------------------------------------------------------------
-RG