I have created a VBScript and have no idea why it won't echo out the results. I know the cmd command works on its own if I ended the script there as I set the parameter to 1 and seen the output.
I have also tried storing it as strObjPing
but that doesn't work either
'' Sets up shell ''
Set objShell = CreateObject("Wscript.Shell")
'' Gets hostname ''
Dim strComputerName
strComputerName = objShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
'' Runs ping in cmd. Stores output. ''
Dim ObjPing
ObjPing = objShell.Run "ping " & strComputerName, 1, True
'' Execute program and read the output into a variable line by line ''
Dim strFromProc
Do
strFromProc = ObjPing.StdOut.ReadLine()
WScript.Echo "Output is: " & strFromProc
Loop While Not ObjPing.Stdout.atEndOfStream
objShell.Quit