To execute the “ipconfig /all” command on one or more remote machines you can use the psexec utility that is part of pstools, available from Microsoft. The syntax is: pstools \\machine_name command
For example:
C:\Users\dmatthews\Desktop\pstools>psexec \\L00151270 ipconfig /all
To list just the IP version 4 address, pipe the output throught the ‘find’ command:
C:\Users\dmatthews\Desktop\pstools>psexec \\L00151270 ipconfig /all | find “IPv4″
If you have a number of machines that you wish to enumerate, you can use the syntact pstools @filename where filename is a list of machine names:
C:\Users\dmatthew\Desktop\pstools>type INPUT-DATA.txt
L00151270
L00151309
For example:
C:\Users\dmatthew\Desktop\pstools>psexec @INPUT-DATA.txt ipconfig /all | find “IPv4″
Starting ipconfig on L00151270… L00151270…
IPv4 Address. . . . . . . . . . . : 172.23.24.22(Preferred)
ipconfig exited on L00151270 with error code 0.
Starting ipconfig on L00151309… L00151309…
IPv4 Address. . . . . . . . . . . : 172.23.25.32(Preferred)
ipconfig exited on L00151309 with error code 0.
Finally you can redirect the output into a text file:
C:\Users\dmatthew\Desktop\pstools>psexec @INPUT-DATA.txt ipconfig /all | find “IPv4″ >> RESULTS.txt
Starting ipconfig on L00151270… L00151270…
ipconfig exited on L00151270 with error code 0.
Starting ipconfig on L00151309… L00151309…
ipconfig exited on L00151309 with error code 0.
C:\Users\dmatthew\Desktop\pstools>type RESULTS.txt
IPv4 Address. . . . . . . . . . . : 172.23.24.22(Preferred)
IPv4 Address. . . . . . . . . . . : 172.23.25.32(Preferred)
Leave A Comment?
You must be logged in to post a comment.