Get Ip Address of remote computer and output to Txt File

By khalid722 ·
Basically I need to get the ipconfig /all command of a remote computer into text file

I have searched the net high and low for scripts including WMI scripts there is one script that does this but it just displays the ipconfig /all details of the pc it is being run from the script details are below;

strComputer = InputBox _
("Please enter the name of the computer you want to connect to:", _
"Enter Computer Name", strLocalComputer)

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists("IpConfigResults.Txt") Then
objFSO.DeleteFile "IpConfigResults.Txt"
End If

strCommand = "Ipconfig /All"
Set objExecObject = objShell.Exec(strCommand)
Do While Not objExecObject.StdOut.AtEndOfStream
strResults = objExecObject.StdOut.ReadAll()

strText = strText & strResults
Set objFile = objFSO.CreateTextFile("IpConfigResults.Txt")
objFile.Write strText

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("IpConfigResults.Txt", ForReading)
strResults = objTextFile.ReadAll

Set objShell = CreateObject("Wscript.Shell")
strArgument = "notepad.exe " & chr(34) & "IpConfigResults.Txt" & chr(34)
objShell.Run strArgument

many thanks ps i have no idea of scripting and just wangled my way to this far

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Related Discussions

Related Forums