Jump to content

IPCONFIG Windowed


RocTx
 Share

Recommended Posts

Nothing earth shattering.. just a small script to display your IP information.

Supporting 500+ users.. it's just painstaking to direct them to the "Dos Prompt" to run

the IPCONFIG command. I created this script to be accessible from a Server network

share so they can easily navigate to it and double click it to give me the IP information I may need to help them.

#include <File.au3>
Dim $temp, $arr
RunWait(@ComSpec & " /c " & "IPCONFIG.EXE /all > IPINFO.TXT", @MyDocumentsDir, @SW_HIDE)
_FileReadToArray(@MyDocumentsDir & "\IPINFO.TXT", $temp )

For $n = 1 to $temp[0]

   $arr = $arr & StringStripWS($temp[$n],4)

;  MsgBox(0,"Value of $ar", "Value of $ar is: " & $temp[$n])

Next

MsgBox(0, "IP Configuration Information", "Logged User:" & @UserName & @LF & $arr & @LF & @LF & @LF)
RunWait(@ComSpec & " /c " & "DEL.EXE IPINFO.TXT", @MyDocumentsDir, @SW_HIDE)

RocTx

Link to comment
Share on other sites

  • 2 weeks later...

Updated to select switches and Gui'd

#include <GuiConstants.au3>
#include <File.au3>

Ask()

Func Ask()
GUICreate("IP Config",400,500)
Opt("GUICoordMode", 1)
GUISetFont(12, 800,4,"Arial")
GUICtrlCreateLabel ("IP Config Options",  125, 20, 200)
GUISetFont(10, 800,0,"Arial")
GUICtrlCreateLabel ("Display",  160, 70, 200)
GUICtrlCreateLabel ("Update",  162, 140, 200)
GUISetFont(9,400,0,"")

$Sel1 = GUICtrlCreateRadio("Simple IP Info", 40, 100, 120, 20)
GUICtrlSetState(-1,$GUI_CHECKED)
$Sel2 = GUICtrlCreateRadio("All IP Info", 250, 100, 120, 20)
$Sel3 = GUICtrlCreateRadio("Renew IP", 40, 170, 120, 20)
$Sel4 = GUICtrlCreateRadio("Release IP", 250, 170, 120, 20)
$Sel5 = GUICtrlCreateRadio("Flush DNS", 40, 200, 120, 20)
$Sel6 = GUICtrlCreateRadio("Re-Register IP/DNS", 250, 200, 120, 20)
$ok = GUICtrlCreateButton("OK", 100, 400, 80)
$Cancel = GUICtrlCreateButton("Cancel/Exit", 200,400,80)
GUISetState()
; Run the GUI until the dialog is closed
While 1
  $msg = GUIGetMsg()
  Select
     Case $msg = -3
        Exit
     Case $msg = $ok
        ExitLoop
     Case $msg = $Cancel
        Exit
  EndSelect
Wend

If GUIRead($Sel1) = 1 Then $Sel = ""
If GUIRead($Sel2) = 1 Then $Sel = "/ALL"
If GUIRead($Sel3) = 1 Then $Sel = "/RENEW"
If GUIRead($Sel4) = 1 Then $Sel = "/RELEASE"
If GUIRead($Sel5) = 1 Then $Sel = "/FLUSHDNS"
If GUIRead($Sel6) = 1 Then $Sel = "/REREGISTERDNS"

GuiDelete()

GetInfo($Sel)
Ask()
EndFunc

Func GetInfo($Sel)
Dim $temp, $arr
;RunWait(@ComSpec & " /c " & "IPCONFIG.EXE /all > IPINFO.TXT", @MyDocumentsDir, @SW_HIDE)
RunWait(@ComSpec & " /c " & "IPCONFIG.EXE " & $Sel & " > " & "IPINFO.TXT", @MyDocumentsDir, @SW_HIDE)
_FileReadToArray(@MyDocumentsDir & "\IPINFO.TXT", $temp )

For $n = 1 to $temp[0]

   $arr = $arr & StringStripWS($temp[$n],4)

Next

MsgBox(0, "IP Configuration Information", "Logged User:" & @UserName & @LF & $arr & @LF & @LF & @LF)
RunWait(@ComSpec & " /c " & "DEL.EXE IPINFO.TXT", @MyDocumentsDir, @SW_HIDE)
EndFunc
Link to comment
Share on other sites

Not bad, you know Microsoft already has a winipcfg for 2000/XP/2003, right? Of course it doesn't ship with the OS, but you can download it from their website.

WntIpcfg

Good work on the script though, I was just trying to save you time from re-inventing the wheel. Although if you enjoy doing it, never mind then! I know I enjoy writing scripts, whether they're useful or not! :idiot:

Link to comment
Share on other sites

Updated to select switches and Gui'd

#include <GuiConstants.au3>
#include <File.au3>

Ask()

Func Ask()
GUICreate("IP Config",400,500)
Opt("GUICoordMode", 1)
GUISetFont(12, 800,4,"Arial")
GUICtrlCreateLabel ("IP Config Options",  125, 20, 200)
GUISetFont(10, 800,0,"Arial")
GUICtrlCreateLabel ("Display",  160, 70, 200)
GUICtrlCreateLabel ("Update",  162, 140, 200)
GUISetFont(9,400,0,"")

$Sel1 = GUICtrlCreateRadio("Simple IP Info", 40, 100, 120, 20)
GUICtrlSetState(-1,$GUI_CHECKED)
$Sel2 = GUICtrlCreateRadio("All IP Info", 250, 100, 120, 20)
$Sel3 = GUICtrlCreateRadio("Renew IP", 40, 170, 120, 20)
$Sel4 = GUICtrlCreateRadio("Release IP", 250, 170, 120, 20)
$Sel5 = GUICtrlCreateRadio("Flush DNS", 40, 200, 120, 20)
$Sel6 = GUICtrlCreateRadio("Re-Register IP/DNS", 250, 200, 120, 20)
$ok = GUICtrlCreateButton("OK", 100, 400, 80)
$Cancel = GUICtrlCreateButton("Cancel/Exit", 200,400,80)
GUISetState()
; Run the GUI until the dialog is closed
While 1
  $msg = GUIGetMsg()
  Select
     Case $msg = -3
        Exit
     Case $msg = $ok
        ExitLoop
     Case $msg = $Cancel
        Exit
  EndSelect
Wend

If GUIRead($Sel1) = 1 Then $Sel = ""
If GUIRead($Sel2) = 1 Then $Sel = "/ALL"
If GUIRead($Sel3) = 1 Then $Sel = "/RENEW"
If GUIRead($Sel4) = 1 Then $Sel = "/RELEASE"
If GUIRead($Sel5) = 1 Then $Sel = "/FLUSHDNS"
If GUIRead($Sel6) = 1 Then $Sel = "/REREGISTERDNS"

GuiDelete()

GetInfo($Sel)
Ask()
EndFunc

Func GetInfo($Sel)
Dim $temp, $arr
;RunWait(@ComSpec & " /c " & "IPCONFIG.EXE /all > IPINFO.TXT", @MyDocumentsDir, @SW_HIDE)
RunWait(@ComSpec & " /c " & "IPCONFIG.EXE " & $Sel & " > " & "IPINFO.TXT", @MyDocumentsDir, @SW_HIDE)
_FileReadToArray(@MyDocumentsDir & "\IPINFO.TXT", $temp )

For $n = 1 to $temp[0]

   $arr = $arr & StringStripWS($temp[$n],4)

Next

MsgBox(0, "IP Configuration Information", "Logged User:" & @UserName & @LF & $arr & @LF & @LF & @LF)
RunWait(@ComSpec & " /c " & "DEL.EXE IPINFO.TXT", @MyDocumentsDir, @SW_HIDE)
EndFunc

<{POST_SNAPBACK}>

HMmm i get error in line 7... :/..

But nice app :idiot:

Link to comment
Share on other sites

  • 3 weeks later...

Pretty cool update...I like your scripted version better than Microshaft's...

I deal with a huge network and use SysInternals PsExec program to run scripts and programs remotely on workstations around the domain. Quick and easily scripted, e.g.

PsExec \\computername "ipconfig /all"

You can execute anything as long as it exists on the target workstation. Also, PsExec can copy files to the target workstation for you.

I'd like to see your script remotely connect to the target workstation and reveal the information. I'd bet you could take the user's logon User ID over the phone and scan the domain to find their workstation NetBIOSName all from your computer.

Keep up the good work

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...