Jump to content

Software Retrieval


flip209
 Share

Recommended Posts

Here is a script kind of like the VBS script that will retrieve all software that is installed. Please Comment... :)

global $Os

$file = FileOpen("start.tmp" , 2)
$input = InputBox("Computer Name" , "Please enter the computers IP address or Name to Inventory (Leave Blank to inventory this computer)" )
If @error = 1 Then
Exit
ElseIf $input = "" Then
$computer = ""
ElseIf $input <> ""Then
$computer = "\\"  & $input & "\" 
EndIf
$i = 1
While 1
$var = RegEnumKey($computer & "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows\currentversion\uninstall" , $i)
If @error = 1 Then
ContinueLoop
ElseIf @error = 2 Then
ExitLoop
ElseIf @error = -1 Then
ExitLoop
EndIf
FileWriteLine($file, $var)
$i += 1
WEnd
FileClose($file)
$for = 1
$software = FileOpen("soft.txt" , 2)
For $for = 1 To $i
$line = FileReadLine("start.tmp" , $for)
$display = RegRead($computer & "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows\currentversion\uninstall\"  & $line, "DisplayName" )
If $display = "" Then
$count = 1
While 1
$var = RegEnumKey($computer & "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows\currentversion\uninstall\"  & $line, $count)
If @error = 1 Then
ContinueLoop
ElseIf @error = 2 Then
ExitLoop
ElseIf @error = -1 Then
ExitLoop
EndIf
if @error = 0 Then
$display = RegRead($computer & "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows\currentversion\uninstall\"  & $line & "\"  & $var, "DisplayName" )
EndIf
$count += 1
WEnd
EndIf
if $display <> "" then
FileWriteLine($software, $display)
EndIf
Next
ShellExecute("soft.txt" )
Edited by flip209

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Link to comment
Share on other sites

To make you post more "legible"

Use [ autoit] tags instead of code and use tidy in SciTe. It will look much better

8)

The AutoIt tag button has not worked for me for a long time now.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

test... I always type it in [ autoit] ; post code [ /autoit]

NoTrayIcon
#include<guiconstants.au3>
#include<misc.au3>
#include<string.au3>
Opt("MouseCoordMode", 2)
Opt("WinSearchChildren", 1)
Opt("WinTitleMatchMode", 4)
$item32 = "Pinchers.ICO|Options"  ;moved from list below.
$item33 = "Door2.ico|Exit Toolbar"  ;moved from list below

8)

EDIT: its not working now for sure!!!

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

I did run Tidy but I also ran the obfuscated. Which the obfuscated is what I post I also took the fake func out so that any one could use it. But hay what ever if you do not like my scripts do not use them.

Edited by flip209

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Link to comment
Share on other sites

I spit it into a text file because this is step one. I am making a gui so you can add a list of computers and run this check on that list then the results will spit out a HTML report. I have a list version in my network searcher (just updated today). I was also thinking about making a registry mapping program.

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Link to comment
Share on other sites

If you want to add installed updates to the mix here is the code I used to do it. I added the MsgBox for display only.

$Uobj = ObjCreate("Microsoft.Update.Session")
$oSearch = $Uobj.CreateUpdateSearcher
$hCount = Int($oSearch.GetTotalHistoryCount) -1
$dCount = 0
$colHistory = $oSearch.QueryHistory(1, $hCount)

For $objEntry in $colHistory
    $hOut = ""
    $dCount += 1
    $hOut &= "Date: " & _DisplayDate($objEntry.Date, 0, 1) & @CRLF
    $hOut &= "Name: " & $objEntry.Title & @CRLF & @CRLF
    $hOut &= "Description: " & $objEntry.Description & @CRLF & @CRLF
    $hOut &= "Client application ID: " & $objEntry.ClientApplicationID & @CRLF & @CRLF
    $i = 1
    For $strStep in $objEntry.UninstallationSteps()
        $hOut &= $i & " -- " & $strStep & @CRLF
        $i += 1
    Next
    $hOut &= @CRLF
    $hOut &= "Uninstallation Notes: " & $objEntry.UninstallationNotes & @CRLF
    $hOut &= "Support URL: " & $objEntry.SupportURL
    MsgBox(0, "Update History " & $dCount & " of " & $hCount, $hOut)
Next

Func _DisplayDate($iDate, $iTime = 1, $mLong = 0, $yDelim = "/", $tDelim = ":")
   Local $ap = " PM", $tStr = "", $oTime = ""
   $aMonth = StringSplit("January|February|March|April|May|June|July|August|September|October|November|December", "|")
   $dStr = StringLeft($iDate, 8)
   If StringLen($iDate) < 9 Then $iTime = 0
   If $iTime = 1 Then
      $tStr = StringReplace($iDate, $dStr, "")
      $oTime = "  "
      $tHr = StringLeft($tStr, 2)
      If $tHr < 12 Then
         $ap = " AM"
         If $tHr = 0 Then $tHr = 12
      EndIf
      $oTime &= $tHr & $tDelim & StringMid($tStr, 3, 2) & $tDelim & StringRight($tStr, 2) & $ap
   EndIf
   $yStr = $yDelim & StringLeft($dStr, 4)
   $mStr = $aMonth[StringRight($dStr, 2)]
   If $mLong = 0 Then $mStr = StringLeft($mStr, 3)
   $mStr &= Chr(32)
   $dStr = StringMid($dStr, 5, 2)
   $oDate = $mStr & $dStr & $yStr
   Return $oDate & $oTime
EndFunc

You will have to watch the line wrap on the StringSplit(

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Thank you GEOsoft I may look into that...

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

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...