MikeT Posted January 27, 2010 Share Posted January 27, 2010 I coded this for my IT department. Requires local admin rights on the remote machine. Could be cleaned up a bit. But may help with some of your projects. (I'm new to AutoIT so be easy) expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <File.au3> ;Do not edit====================== #Region ### START Koda GUI section ### Form= $RemoteReg = GUICreate("Remote Registry Tool", 548, 179, 192, 114) $KeyToRead = GUICtrlCreateCombo("HKLM", 0, 72, 94, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "HKU|HKCR|HKCC") $KeyToBeRead = GUICtrlCreateLabel("Key to read:", 0, 54, 73, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $KeyName = GUICtrlCreateInput("SOFTWARE\Microsoft\Windows\CurrentVersion", 96, 72, 297, 21) $KeyNam = GUICtrlCreateLabel("Key name:", 96, 54, 63, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $ValueName = GUICtrlCreateInput("ProgramFilesDir", 395, 72, 150, 21) $ValueNam = GUICtrlCreateLabel("Value Name:", 395, 54, 76, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $ListToQuery = GUICtrlCreateInput("C:\computers.txt", 0, 24, 169, 21) $ListToQuer = GUICtrlCreateLabel("List of PC's to Query:", 0, 6, 124, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Browse = GUICtrlCreateButton("Browse...", 168, 24, 57, 22) $SaveResults = GUICtrlCreateInput("C:\results.txt", 312, 24, 169, 21) $SaveResult = GUICtrlCreateLabel("Save results to:", 312, 6, 93, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $SaveTo = GUICtrlCreateButton("Browse...", 480, 24, 57, 22) $List1 = GUICtrlCreateList("", 184, 120, 361, 58) $Results = GUICtrlCreateLabel("Live Results:", 184, 104, 78, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Start = GUICtrlCreateButton("Start", 8, 104, 161, 73) GUICtrlSetFont(-1, 28, 800, 0, "Verdana") $Done = GUICtrlCreateLabel("", 260, 104, 284, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;================================== Func Start() ;Open's user defined txt file, and counts the number of lines $TXTFile = GUICtrlRead($ListToQuery) $ToBeRead = $TXTFile $Count = _FileCountLines($ToBeRead) $FinalCount = ($Count) $Subtract = 1 $Number = $FinalCount $ReadInput=FileOpen(GUICtrlRead($ListToQuery),0) While 1 $ComputerName=FileReadLine($ReadInput) If @Error=-1 then ExitLoop $KeyChoice = GUICtrlRead($KeyToRead) $Key = GUICtrlRead($KeyName) $KeyV = GUICtrlRead($ValueName) $Ping = Ping($ComputerName,1000) $CompiledString = "\\" & $ComputerName & "\" & $KeyChoice & "\" & $Key If $Ping Then $KeyReader = RegRead($CompiledString, $KeyV) FileWriteLine(GUICtrlRead($SaveResults), $ComputerName & ":" & $KeyReader) _GUICtrlListBox_AddString ($List1, $ComputerName & ":" & $KeyReader) Else FileWriteLine(GUICtrlRead($SaveResults), $ComputerName & ":is off or does not exist") _GUICtrlListBox_AddString ($List1, $ComputerName & ":is off or does not exist") EndIf GuiCtrlSetData($Done, $subtract & " of " & $FinalCount) $Subtract = $Subtract + 1 Wend MsgBox(0, "", "Finshed checking remote registry, results saved to: " & GUICtrlRead($SaveResults)) EndFunc Func Browse() $filetocheck = FileOpenDialog("", @DesktopCommonDir & "", "Text Files (*.txt)", 1 + 4 ) If @error Then MsgBox(4096,"","You didn't choose a file, reverting to default.") Else GuiCtrlSetData($ListToQuery,$filetocheck) EndIf EndFunc Func Save() $filetosave = FileSaveDialog("", @DesktopCommonDir & "", "Text Files (*.txt)", 1 + 4 ) If @error Then MsgBox(4096,"","You didn't choose a file, reverting to default.") Else GuiCtrlSetData($SaveResults,$filetosave & ".txt") EndIf EndFunc ;Do not edit====================== While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start Start() Case $Browse Browse() Case $SaveTo Save() EndSwitch WEnd ;=================================== Link to comment Share on other sites More sharing options...
MikeT Posted December 23, 2010 Author Share Posted December 23, 2010 bump Link to comment Share on other sites More sharing options...
Developers Jos Posted December 23, 2010 Developers Share Posted December 23, 2010 bumpDon't tell me you have be waiting for a solution for 11 months... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
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