RocTx Posted November 18, 2004 Posted November 18, 2004 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
RocTx Posted December 1, 2004 Author Posted December 1, 2004 Updated to select switches and Gui'd expandcollapse popup#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
archrival Posted December 1, 2004 Posted December 1, 2004 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.WntIpcfgGood 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!
RocTx Posted December 2, 2004 Author Posted December 2, 2004 Thanks Archrival.. no I did not know M$ had a WinIPCFG tool. I'll download it and check it out. I do enjoy scripting.. figuring out things and how to do things. RocTx
archrival Posted December 2, 2004 Posted December 2, 2004 Yeah, not trying to discourage you, I know what you mean about scripting being fun.
YpR^ Posted December 2, 2004 Posted December 2, 2004 RocTx said: Updated to select switches and Gui'dexpandcollapse popup#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
GuruBaron Posted December 19, 2004 Posted December 19, 2004 (edited) I was also get Line 7 error message: Error: Unknown function name. Running v3.0.102 and updated to .103 fixed the problem Edited December 19, 2004 by GuruBaron
PerryRaptor Posted December 20, 2004 Posted December 20, 2004 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
sykes Posted December 20, 2004 Posted December 20, 2004 Not a bad Program there RocTx ... Very nice alternative to microsofts stuff We have enough youth. How about a fountain of SMART?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now