Xenobiologist Posted November 15, 2005 Share Posted November 15, 2005 Hello, is anybody out there who shares his code, how to list the installed software on a windows xp system? I´d like to go through the registry and list the entries of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall But I don´t know how to build the loop, so that I can see every entry. The dsiplay name will be good enough for the first run. Thank you So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Puckmeister Posted November 15, 2005 Share Posted November 15, 2005 (edited) hi, hope this can halp you #include <GUIConstants.au3> $gui_width = 500 $gui_height = 600 Global $count = 1, $all_keys = "", $main_key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" GUICreate("Installed Software", $gui_width, $gui_height, @Desktopwidth/2 - $gui_width/2, @DesktopHeight/2 - $gui_height/2 - 75) $gui_list = GUICtrlCreateList ("", 10, 10, $gui_width - 20, $gui_height - 20) GUISetState () While 1 $act_key = RegEnumKey ($main_key, $count) If @error <> 0 then ExitLoop $act_name = RegRead ($main_key & "\" & $act_key, "Displayname") $act_name = StringReplace ($act_name, " (remove only)", "") If $act_name <> "" Then $all_keys = $all_keys & $act_name & "|" $count = $count + 1 WEnd GUICtrlSetData ($gui_list, $all_keys) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend greets, chris Edited November 15, 2005 by sirhc Link to comment Share on other sites More sharing options...
Xenobiologist Posted November 15, 2005 Author Share Posted November 15, 2005 (edited) Thank you very much! Now, I can try to create similiar things on my own. Very well done So long, Mega P.S. Sehe gerade, dass du aus Deutschland kommst :-) Also nochmal besten Dank. Ich suche nämlich gerade nach einer Möglichkeit über die Kommandozeile auf einem fremden Rechner Informationen abzurufen, um diese für Supportzwecke nutzen zu können. Dabei darf der User natürlich nicht bei der Arbeit gestört werden, deshalb werde ich die Informationen in eine txt umleiten. Mal sehen, was außer der Softwareliste noch interessant ist, ggf. werde ich dein Skript dann noch erweitern. Edited November 15, 2005 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Danny35d Posted November 15, 2005 Share Posted November 15, 2005 I have a function very similar to the script from sirhc. This function will give you an array list of all software installed in the local system or remote system. expandcollapse popup#include <Array.au3> $ret = _InstalledSoftware(); Return array with all software intalled on the local system _ArrayDisplay($ret, '') $ret = _InstalledSoftware('ComputerName'); Return array with all software installed on the remote system _ArrayDisplay($ret, '') exit ;=============================================================================== ; Function Name: _InstalledSoftware() ; ; Description: Return a dimensional array with all software installed in your system ; or remote system. ; ; Syntax: _InstalledSoftware ( [$s_RemoteComputer] ) ; ; Parameter(s): $s_RemoteComputer = ComputerName on the network ; ; Requirement(s): External: = None. ; Internal: = None. ; ; Return Value(s): On Success: = Returns a dimensional array with all software install and ; sets @error to 0. ; On Failure: = Returns "" and sets @error to 1. ; ; Author(s): Danny35d ; ; Note(s): ; ; Example(s): ; __InstalledSoftware("ComputerName") it will return an array with all software installed ; on the remote computer. ; __InstalledSoftware() it will return an array with all software installed localy ;=============================================================================== Func _InstalledSoftware($s_RemoteComputer = '') Local $Count = 1 If $s_RemoteComputer <> '' Then If StringMid($s_RemoteComputer, 1, 1) <> '\' Or StringMid($s_RemoteComputer, 2, 1) <> '\' Or StringRight($s_RemoteComputer, 1) <> '\' Then $s_RemoteComputer = '\\' & StringReplace($s_RemoteComputer, '\', '') & '\' EndIf EndIf Local Const $regkey = $s_RemoteComputer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' While 1 $key = RegEnumKey ($regkey, $Count) If @error <> 0 then ExitLoop $line = RegRead ($regkey & '\' & $key, 'Displayname') $line = StringReplace ($line, ' (remove only)', '') If $line <> '' Then If Not IsDeclared('avArray') Then Dim $avArray[1] ReDim $avArray[UBound($avArray) + 1] $avArray[0] = UBound($avArray) - 1 $avArray[UBound($avArray) - 1] = $line EndIf $Count = $Count + 1 WEnd If Not IsDeclared('avArray') Then SetError(1) Return('') Else SetError(0) Return($avArray) EndIf EndFunc AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
busysignal Posted November 20, 2005 Share Posted November 20, 2005 @Danny35d, thanks for sharing.. Works Great! Cheers.. Link to comment Share on other sites More sharing options...
Danny35d Posted November 20, 2005 Share Posted November 20, 2005 @Busysignal your welcome! AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Xenobiologist Posted November 20, 2005 Author Share Posted November 20, 2005 (edited) Hi, that is what I did so far. It´s not very good but it does the things I want it to do. It need the script, to transfer it via ftp to an PC which I want to support. Therefore we use NetOp/ATOS. The user who is currently working at the computer doesn´t recognize anything from that action . We are using the system-user in the background. Then I can start my little script and it gathers a little informtion for me. After all I´ll copy the result via ftp back to my PC and now I can study the files before calling the worker. For the copy action I did another script. Maybe nobody can use my scripts, but if - feel free or tell me something to improve, so I can learn more about AUTOIT. Thank U very much So long, Mega PCInfo script expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.1 beta ; Author: Thorsten Meger ; ; Script Function: ; ; Gather some information and save them in 7 files. ; ---------------------------------------------------------------------------- #include <Array.au3> #include <file.au3> #include <Process.au3> #NoTrayIcon $b = TimerInit() $file = FileOpen(@ScriptDir & "\" & "TM_Software.txt", 2) $file1 = FileOpen(@ScriptDir & "\" & "TM_AutoStart.txt", 2) $file2 = FileOpen(@ScriptDir & "\" & "TM_User.txt", 2) $file3 = FileOpen(@ScriptDir & "\" & "TM_ProcessList.txt", 2) FileWriteLine($file, "Softwarekomponente " & "Version " & "Herausgeber " & "UninstallString") Call("installedSoftware"); Return array with all software intalled on the local system Call("ipconfig") Call("autoStart") Call("system") Call("process") Call("environment") Call("windows") FileClose($file) FileClose($file1) FileWriteLine($file2, "************************************************************************************************ *****") FileWriteLine($file2, "Die Auswertung mit PcInfo von Th.Meger dauerte : " & Round(TimerDiff($b)) & " ms") FileClose($file2) FileClose($file3) Exit (0) Func installedSoftware() Local $Count = 1 Local Const $regkey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' While 1 $key = RegEnumKey($regkey, $Count) If @error <> 0 Then ExitLoop $line = RegRead($regkey & '\' & $key, 'Displayname') $line1 = RegRead($regkey & '\' & $key, 'DisplayVersion') $line2 = RegRead($regkey & '\' & $key, 'Publisher') $line3 = RegRead($regkey & '\' & $key, 'UninstallString') $line = StringReplace($line, ' (remove only)', '') $line = fullfill(60, $line, ' ') $line1 = fullfill(15, $line1, ' ') $line2 = fullfill(20, $line2, ' ') FileWriteLine($file, $line & $line1 & $line2 & $line3) If $line <> '' Then If Not IsDeclared('avArray') Then Dim $avArray[1] ReDim $avArray[UBound($avArray) + 1] $avArray[0] = UBound($avArray) - 1 $avArray[UBound($avArray) - 1] = $line EndIf $Count = $Count + 1 WEnd If Not IsDeclared('avArray') Then SetError(1) Return ('') Else SetError(0) Return ($avArray) EndIf EndFunc ;==>installedSoftware Func fullfill($maxLength, $string, $fullFillChar) ; $maxLength = maximum string size ; $fullFillChar = char to fullfill the string While 1 If StringLen($string) < $maxLength Then $string = $string & $fullFillChar ContinueLoop EndIf ExitLoop WEnd Return $string EndFunc ;==>fullfill Func ipconfig() Run(@ComSpec & " /c " & "ipconfig /all > " & @ScriptDir & "\" & "TM_IPconfig.txt", "", @SW_HIDE) EndFunc ;==>ipconfig Func autoStart() Local $Count = 1 Local Const $regkey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' While 1 $key = RegEnumVal($regkey, $Count) If @error <> 0 Then ExitLoop ;$line = RegRead ($regkey & '\' & $key, 'Displayname') $line = RegRead($regkey, $key) FileWriteLine($file1, $line) If $line <> '' Then If Not IsDeclared('avArray') Then Dim $avArray[1] ReDim $avArray[UBound($avArray) + 1] $avArray[0] = UBound($avArray) - 1 $avArray[UBound($avArray) - 1] = $line EndIf $Count = $Count + 1 WEnd If Not IsDeclared('avArray') Then SetError(1) Return ('') Else SetError(0) Return ($avArray) EndIf EndFunc ;==>autoStart Func system() $hdSizeC = DriveSpaceTotal( "c:\") $hdFreeSizeC = DriveSpaceFree( "c:\") $hdSizeD = DriveSpaceTotal( "d:\") $hdFreeSizeD = DriveSpaceFree( "d:\") FileWriteLine($file2, "Hostname : " & @ComputerName & @CRLF & "Domäne : " & @LogonDomain & @CRLF & "LogonServer : " & @LogonServer & @CRLF & "Betriebssystemtyp : " & @OSTYPE & @CRLF & "Version : " & @OSVersion & @CRLF & "ServicePack : " & @OSServicePack & @CRLF & "Laufwerk C Größe : " & Round($hdSizeC) & "MB" & @CRLF & "Laufwerk C Frei : " & Round($hdFreeSizeC) & "MB" & @CRLF & "Laufwerk D Größe : " & Round($hdSizeD) & "MB" & @CRLF & "Laufwerk D Frei : " & Round($hdFreeSizeD) & "MB" & @CRLF & "Angemeldeter User : " & @UserName) If IsAdmin() Then FileWriteLine($file2, "Rechte : Administrator" & @CRLF) Else FileWriteLine($file2, "Rechte : User" & @CRLF) EndIf EndFunc ;==>system Func process() $list = ProcessList() For $i = 1 To $list[0][0] FileWriteLine($file3, $list[$i][0]) Next EndFunc ;==>process Func environment() Run(@ComSpec & " /c " & "set > " & @ScriptDir & "\" & "TM_Environment.txt", "", @SW_HIDE) sleep(200) Run(@ComSpec & " /c " & "net use >> " & @ScriptDir & "\" & "TM_Environment.txt", "", @SW_HIDE) EndFunc ;==>environment Func windows() Local $Count = 1 Local Const $regkey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion' Run(@ComSpec & " /c " & "netsh diag show os /v > " & @ScriptDir & "\" & "TM_Windows.txt", "", @SW_HIDE) EndFunc ;==>windows **************************************************************** Copy script **************************************************************** ; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.1 beta ; Author: Thorsten Meger ; ; Script Function: Copies the files back ; ; ---------------------------------------------------------------------------- opt("WinTitleMatchMode", 2) opt("SendKeyDelay", 50) HotKeySet("{F2}", "eingabe") HotKeySet("{F4}", "doIt") HotKeySet("{F6}", "backFtp") HotKeySet("{F8}", "delete") HotKeySet("{F10}", "terminate") $string = @ScriptDir $string2 = StringReplace($string, "\", "//") $string3 = StringTrimLeft($string2, 4) Call("start") Func eingabe() Send("mode ft" & "{Enter}") Sleep(2000) Call("ftp") EndFunc ;==>eingabe Func ftp() Send("put v://" & $string3 & "//PcInfoTM.exe c://winnt//temp//PcInfoTM.exe" & "{Enter}") EndFunc ;==>ftp Func start() While 1 Sleep(500) WEnd EndFunc ;==>start Func doIt() Send("mode rls" & "{Enter}") Sleep(400) Send("connect" & "{Enter}") Sleep(3000) Send("start c:\winnt\temp\pcinfotm.exe" & "{Enter}") EndFunc ;==>doIt Func backFtp() DirCreate($string & "\PCInfo") Send("mode ft" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_Autostart.txt v://" & $string3 & "//PCinfo//" & "TM_Autostart.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_Software.txt v://" & $string3 & "//PCinfo//" & "TM_Software.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_User.txt v://" & $string3 & "//PCinfo//" & "TM_User.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_ProcessList.txt v://" & $string3 & "//PCinfo//" & "TM_ProcessList.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_Environment.txt v://" & $string3 & "//PCinfo//" & "TM_Environment.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_Windows.txt v://" & $string3 & "//PCinfo//" & "TM_Windows.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_IPconfig.txt v://" & $string3 & "//PCinfo//" & "TM_IPconfig.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_IPconfig.txt v://" & $string3 & "//PCinfo//" & "TM_IPconfig.txt" & "{Enter}") EndFunc ;==>backFtp Func delete() Send("mode rls" & "{Enter}") Sleep(400) Send("connect" & "{Enter}") Sleep(2000) Send("del c:\winnt\temp\TM_*.txt" & "{Enter}") Send("del c:\winnt\temp\pcinfotm.exe" & "{Enter}") MsgBox(0, "PcInfoTM", "© Th.Meger", 2) EndFunc ;==>delete Func terminate() Exit (0) EndFunc ;==>terminate Edited November 24, 2005 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
PartyPooper Posted November 20, 2005 Share Posted November 20, 2005 You may want to remove the Call functions and replace them with direct calls for increased script speed like so:; ----------------------------------------------------------------------------;; AutoIt Version: 3.1.1 beta; Author: Thorsten Meger ;; Script Function:;; Gather some information and save them in 7 files.; ----------------------------------------------------------------------------#include <Array.au3>#include <file.au3>#include <Process.au3>#NoTrayIcon$b = TimerInit()$file = FileOpen(@ScriptDir & "\" & "TM_Software.txt", 2)$file1 = FileOpen(@ScriptDir & "\" & "TM_AutoStart.txt", 2)$file2 = FileOpen(@ScriptDir & "\" & "TM_User.txt", 2)$file3 = FileOpen(@ScriptDir & "\" & "TM_ProcessList.txt", 2)FileWriteLine($file, "Softwarekomponente " & "Version " & "Herausgeber " & "UninstallString")installedSoftware(); Return array with all software intalled on the local systemipconfig()autoStart()system()process()environment()windows()FileClose($file)FileClose($file1)FileWriteLine($file2, "*****************************************************************************************************")FileWriteLine($file2, "Die Auswertung mit PcInfo von Th.Meger dauerte : " & Round(TimerDiff($) & " ms")FileClose($file2)FileClose($file3)Exit (0)Func installedSoftware() Local $Count = 1 Local Const $regkey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' While 1 $key = RegEnumKey($regkey, $Count) If @error <> 0 Then ExitLoop $line = RegRead($regkey & '\' & $key, 'Displayname') $line1 = RegRead($regkey & '\' & $key, 'DisplayVersion') $line2 = RegRead($regkey & '\' & $key, 'Publisher') $line3 = RegRead($regkey & '\' & $key, 'UninstallString') $line = StringReplace($line, ' (remove only)', '') $line = fullfill(60, $line, ' ') $line1 = fullfill(15, $line1, ' ') $line2 = fullfill(20, $line2, ' ') FileWriteLine($file, $line & $line1 & $line2 & $line3) If $line <> '' Then If Not IsDeclared('avArray') Then Dim $avArray[1] ReDim $avArray[uBound($avArray) + 1] $avArray[0] = UBound($avArray) - 1 $avArray[uBound($avArray) - 1] = $line EndIf $Count = $Count + 1 WEnd If Not IsDeclared('avArray') Then SetError(1) Return ('') Else SetError(0) Return ($avArray) EndIfEndFunc ;==>installedSoftwareFunc fullfill($maxLength, $string, $fullFillChar) ; $maxLength = maximum string size ; $fullFillChar = char to fullfill the string While 1 If StringLen($string) < $maxLength Then $string = $string & $fullFillChar ContinueLoop EndIf ExitLoop WEnd Return $stringEndFunc ;==>fullfillFunc ipconfig() Run(@ComSpec & " /c " & "ipconfig /all > " & @ScriptDir & "\" & "TM_IPconfig.txt", "", @SW_HIDE)EndFunc ;==>ipconfigFunc autoStart() Local $Count = 1 Local Const $regkey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' While 1 $key = RegEnumVal($regkey, $Count) If @error <> 0 Then ExitLoop ;$line = RegRead ($regkey & '\' & $key, 'Displayname') $line = RegRead($regkey, $key) FileWriteLine($file1, $line) If $line <> '' Then If Not IsDeclared('avArray') Then Dim $avArray[1] ReDim $avArray[uBound($avArray) + 1] $avArray[0] = UBound($avArray) - 1 $avArray[uBound($avArray) - 1] = $line EndIf $Count = $Count + 1 WEnd If Not IsDeclared('avArray') Then SetError(1) Return ('') Else SetError(0) Return ($avArray) EndIfEndFunc ;==>autoStartFunc system() $hdSizeC = DriveSpaceTotal( "c:\") $hdFreeSizeC = DriveSpaceFree( "c:\") $hdSizeD = DriveSpaceTotal( "d:\") $hdFreeSizeD = DriveSpaceFree( "d:\") FileWriteLine($file2, "Hostname : " & @ComputerName & @CRLF & "Domäne : " & @LogonDomain & @CRLF & "LogonServer : " & @LogonServer & @CRLF & "Betriebssystemtyp : " & @OSTYPE & @CRLF & "Version : " & @OSVersion & @CRLF & "ServicePack : " & @OSServicePack & @CRLF & "Laufwerk C Größe : " & Round($hdSizeC) & "MB" & @CRLF & "Laufwerk C Frei : " & Round($hdFreeSizeC) & "MB" & @CRLF & "Laufwerk D Größe : " & Round($hdSizeD) & "MB" & @CRLF & "Laufwerk D Frei : " & Round($hdFreeSizeD) & "MB" & @CRLF & "Angemeldeter User : " & @UserName) If IsAdmin() Then FileWriteLine($file2, "Rechte : Administrator" & @CRLF) Else FileWriteLine($file2, "Rechte : User" & @CRLF) EndIfEndFunc ;==>systemFunc process() $list = ProcessList() For $i = 1 To $list[0][0] FileWriteLine($file3, $list[$i][0]) NextEndFunc ;==>processFunc environment() Run(@ComSpec & " /c " & "set > " & @ScriptDir & "\" & "TM_Environment.txt", "", @SW_HIDE) sleep(200) Run(@ComSpec & " /c " & "net use >> " & @ScriptDir & "\" & "TM_Environment.txt", "", @SW_HIDE)EndFunc ;==>environmentFunc windows() Local $Count = 1 Local Const $regkey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion' Run(@ComSpec & " /c " & "netsh diag show os /v > " & @ScriptDir & "\" & "TM_Windows.txt", "", @SW_HIDE)EndFunc ;==>windows****************************************************************Copy script****************************************************************; ----------------------------------------------------------------------------;; AutoIt Version: 3.1.1 beta; Author: Thorsten Meger ;; Script Function: Copies the files back;; ----------------------------------------------------------------------------opt("WinTitleMatchMode", 2)opt("SendKeyDelay", 50)HotKeySet("{F2}", "eingabe")HotKeySet("{F4}", "doIt")HotKeySet("{F6}", "backFtp")HotKeySet("{F8}", "delete")HotKeySet("{F10}", "terminate")$string = @ScriptDir$string2 = StringReplace($string, "\", "//")$string3 = StringTrimLeft($string2, 4)start()Func eingabe() Send("mode ft" & "{Enter}") Sleep(2000) ftp()EndFunc ;==>eingabeFunc ftp() Send("put v://" & $string3 & "//PcInfoTM.exe c://winnt//temp//PcInfoTM.exe" & "{Enter}")EndFunc ;==>ftpFunc start() While 1 Sleep(500) WEndEndFunc ;==>startFunc doIt() Send("mode rls" & "{Enter}") Sleep(400) Send("connect" & "{Enter}") Sleep(3000) Send("start c:\winnt\temp\pcinfotm.exe" & "{Enter}")EndFunc ;==>doItFunc backFtp() DirCreate($string & "\PCInfo") Send("mode ft" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_Autostart.txt v://" & $string3 & "//PCinfo//" & "TM_Autostart.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_Software.txt v://" & $string3 & "//PCinfo//" & "TM_Software.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_User.txt v://" & $string3 & "//PCinfo//" & "TM_User.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_ProcessList.txt v://" & $string3 & "//PCinfo//" & "TM_ProcessList.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_Environment.txt v://" & $string3 & "//PCinfo//" & "TM_Environment.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_Windows.txt v://" & $string3 & "//PCinfo//" & "TM_Windows.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_IPconfig.txt v://" & $string3 & "//PCinfo//" & "TM_IPconfig.txt" & "{Enter}") Sleep(1500) Send("get c://winnt//temp//" & "TM_IPconfig.txt v://" & $string3 & "//PCinfo//" & "TM_IPconfig.txt" & "{Enter}")EndFunc ;==>backFtpFunc delete() Send("mode rls" & "{Enter}") Sleep(400) Send("connect" & "{Enter}") Sleep(2000) Send("del c:\winnt\temp\TM_*.txt" & "{Enter}") Send("del c:\winnt\temp\pcinfotm.exe" & "{Enter}") MsgBox(0, "PcInfoTM", "© Th.Meger", 2)EndFunc ;==>deleteFunc terminate() Exit (0)EndFunc ;==>terminate Link to comment Share on other sites More sharing options...
busysignal Posted November 24, 2005 Share Posted November 24, 2005 @th.meger, I just want to say thanks for sharing. If you post code please add it using the code tags. It makes it easier to read, cut&paste, etc. Cheers.. Link to comment Share on other sites More sharing options...
Xenobiologist Posted November 24, 2005 Author Share Posted November 24, 2005 HI, I see - I don´t only have to improve my scripts a lot, I also have to improve my posts. MsgBox(262160, "Code Posts", "Set the code tags, please!") Learning goes on and on.... So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Gene Posted December 1, 2005 Share Posted December 1, 2005 (edited) I tried out the one by @Danny35d. I liked it and modified the front end a bit, added an error check for unfound or unresponsive remote computers. Sorted all but the first element of the array and added source and tracking information at the end of the list. I hope some of you find it useful. expandcollapse popup#include <Array.au3> #include <File.au3> ; Embed author and reviser in the compiled EXE. $sAuthor = " InstalledSoftware.EXE was written by Danny35d - Revised by Gene 11/30/2005" ; If there was a command line parameter, use it as the computer name, unless it is a call for help. Select Case $CmdLine[0] = 1 Select Case StringInStr($CmdLine[1], "help") > 0 or StringInStr($CmdLine[1], "/?") > 0 or StringInStr($CmdLine[1], "/h") > 0 or StringInStr($CmdLine[1], "-h") > 0 or StringInStr($CmdLine[1], "-?") > 0 MsgBox(4096,"Help Message","InstalledSoftware.EXE can be run with no parameter or with one parameter. When run with no parameter, it produces a list of software installed locally. When the name of a remote computer on the local area network is given as a parameter and if you have sufficient rights on that computer a list of software on the specified computer is created." & @CRLF & @CRLF & "The program will close in 15 seconds.", 15) Exit Case Else $ret = _InstalledSoftware($CmdLine[1]); Return array with all software intalled on the named system If $ret = "" Then MsgBox(4096,"Error Message", " The remote computer " & StringUpper($CmdLine[1]) & " was not found or didn't respond." & @CRLF & @CRLF & "The program will close in 15 seconds.", 15) Exit EndIf EndSelect Case Else ; Get folder and filename to write list to $sFileName = FileOpenDialog ( "Choose folder and filename for output.", "My Computer", "Text files (*.txt)" , 8 , "InstalledSoftware.txt" ) $ret = _InstalledSoftware(); Return array with all software intalled on the local system EndSelect ; Revise first array item for list If $CmdLine[0] > 0 Then $ret[0] = $ret[0] & " Installed Software Items on " & $CmdLine[1] Else $ret[0] = $ret[0] & " Installed Software Items " EndIf ; Sort all except the first item _ArraySort ( $ret,0 ,1 ) ReDim $ret [UBound($ret)] _ArrayAdd($ret, "== End of list =================================================" ) ReDim $ret [UBound($ret)] _ArrayAdd($ret, $sAuthor ) ReDim $ret [UBound($ret)] _ArrayAdd($ret, " This list created on " & @MON & "/" & @MDAY & "/" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC ) ; Write list to selected file and folder _FileWriteFromArray ($sFileName, $ret) exit ;=============================================================================== ; Function Name: _InstalledSoftware() ; ; Description: Return a dimensional array with all software installed in your system ; or remote system. ; ; Syntax: _InstalledSoftware ( [$s_RemoteComputer] ) ; ; Parameter(s): $s_RemoteComputer = ComputerName on the network ; ; Requirement(s): External: = None. ; Internal: = None. ; ; Return Value(s): On Success: = Returns a dimensional array with all software install and ; sets @error to 0. ; On Failure: = Returns "" and sets @error to 1. ; ; Author(s): Danny35d - Revised by Gene 11/30/2005 ; ; Note(s): ; ; Example(s): ; __InstalledSoftware("ComputerName") it will return an array with all software installed ; on the remote computer. ; __InstalledSoftware() it will return an array with all software installed localy ;=============================================================================== Func _InstalledSoftware($s_RemoteComputer = '') Local $Count = 1 If $s_RemoteComputer <> '' Then If StringMid($s_RemoteComputer, 1, 1) <> '\' Or StringMid($s_RemoteComputer, 2, 1) <> '\' Or StringRight($s_RemoteComputer, 1) <> '\' Then $s_RemoteComputer = '\\' & StringReplace($s_RemoteComputer, '\', '') & '\' EndIf EndIf Local Const $regkey = $s_RemoteComputer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' While 1 $key = RegEnumKey ($regkey, $Count) If @error <> 0 then ExitLoop $line = RegRead ($regkey & '\' & $key, 'Displayname') $line = StringReplace ($line, ' (remove only)', '') If $line <> '' Then If Not IsDeclared('avArray') Then Dim $avArray[1] ReDim $avArray[UBound($avArray) + 1] $avArray[0] = UBound($avArray) - 1 $avArray[UBound($avArray) - 1] = $line EndIf $Count = $Count + 1 WEnd If Not IsDeclared('avArray') Then SetError(1) Return('') Else SetError(0) Return($avArray) EndIf EndFunc Edited December 1, 2005 by Gene [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... 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