Kaseya Community

Report on Add\Remove programs

  • Is there a report that could be run to show the list of add/remove programs? I see that there is an installed apps report but it shows every single EXE on the machine.

  • That report is hiding under Machine Summary --> Add/Remove Programs

  • Got it... Thanks!

    While I'm at it, any ideas on how to run a report that shows the list of services tied to a particular user account. Essentially we need to audit any services or task that is running under a particular account prior to changing the password which may break things in the process.

  • @swagner, - I don't have a report on services tied to login's but I'll see what I can whip up. Also would you like a cool Autoit script that'll scan add/remove and report back on key items? I use it to tell me who's missing Anti-Virus, office versions, etc..... It creates a ticket generated from the machine.

  • Definitely will take that... I'm sure this will come in handy!

  • #include <File.au3>
    #include <Array.au3>


    $sFile = FileOpen("c:\agent temp drive" & @ComputerName & " Installed Software.csv", 0)
    $sText = FileRead($sFile)
    Global $sRite[20]

    Dim $sTest[10]
    $sTest[0] = "Trend Micro Client"
    ;$sTest[1] = "Adobe Reader"
    ;$sTest[2] = "Java"
    ;$sTest[3] = "Adobe Flash"
    ;$sTest[4] = "Microsoft Office 2003"
    ;$sTest[1] = "not here"  ; this one is for testing

    For $i in $sTest
     $sResult = StringRegExp($sText, $i, 0, 1)
    If $sResult = "0" Then
     _ArrayInsert($sRite, 0, $i) 
    $eVentLog = $sRite[0] & @CRLF & $sRite[1] & @CRLF & $sRite[2] & @CRLF & $sRite[3] _
    & @CRLF & $sRite[4] & @CRLF & $sRite[5] & @CRLF & $sRiteDevil

    If $eVentLog <> @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF Then
     $WshShell = ObjCreate("WScript.Shell")
     $WshShell.LogEvent (4, "Your COMPANY NAME HERE Ticket Triger, App's Missing:" & @CRLF & $eVentLog)




    Func _InstalledSoftware($sComputerName = @ComputerName) ;Finds all the for installed software on a remote PC with connection error logging.
        $iInstalledAppsCount = 1
        $sErrorLogFileName = StringTrimRight(@ScriptFullPath, 4) & " Errors.log" ;Error log file.
        $sInstalledAppsLog = "c:\Agent temp drive here" & $sComputerName & " Installed Software.csv"
        $hInstalledAppsLogFile = FileOpen($sInstalledAppsLog, 1) ;Output to a CSV file.

        While 1

            $sSubKey = RegEnumKey("\\" & $sComputerName & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", $iInstalledAppsCount)
            Switch @error
                Case 1, 2, 3
                    If @error = 1 Then _FileWriteLog($sErrorLogFileName, $sComputerName & " : ERROR: You Do Not Have Rights to Access the Remote Registry.")
                    If @error = 2 Or @error = 3 Then _FileWriteLog($sErrorLogFileName, $sComputerName & " : ERROR: Unable to Connect to Remote Registry.")

                    $sNamesOnlyErrorLogFileName = StringTrimRight(@ScriptFullPath, 4) & " Errors-Names only.log"
                    $iFoundComputerName = 0
                    If FileExists($sNamesOnlyErrorLogFileName) Then
                        Local $aComputerNames
                        _FileReadToArray($sNamesOnlyErrorLogFileName, $aComputerNames)
                        For $iNameIndex = 1 To $aComputerNames[0] Step 1
                            If StringInStr($aComputerNames[$iNameIndex], $sComputerName) Then $iFoundComputerName += 1

                    If Not $iFoundComputerName Then
                        $hComputerNames = FileOpen($sNamesOnlyErrorLogFileName, 1)
                        FileWriteLine($hComputerNames, $sComputerName)

                    Return SetError(1, 0, 0)
                Case -1

            $sDisplayName = RegRead("\\" & $sComputerName & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $sSubKey, "DisplayName")
            $sDisplayVersion = RegRead("\\" & $sComputerName & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $sSubKey, "DisplayVersion")

            If $sDisplayName <> "" Then FileWriteLine($hInstalledAppsLogFile, $sDisplayName & "," & $sDisplayVersion)

            $iInstalledAppsCount += 1



        Local $aInstalledApps
        _FileReadToArray($sInstalledAppsLog, $aInstalledApps)
    ;~  _ArrayDisplay($aInstalledApps) ;For Testing.
        _ArraySort($aInstalledApps, 0, 1)
    ;~  _ArrayDisplay($aInstalledApps) ;For Testing.
        _FileWriteFromArray($sInstalledAppsLog, $aInstalledApps, 1)
        _FileWriteToLine($sInstalledAppsLog, 1, "Display Name, Display Version") ;CSV file column headers.

        Return 1


    [edited by: danrche at 4:04 PM (GMT -8) on 1-27-2011] missed one
  • ok, so I know it's a lot, but not really, and I'm a bit of a crappy scriptor so please be kind and don't out right say "you suck" :D

    but I welcome anyone who see's ways to improve on this. I stole the function from Autoit's forums, and built the top half myself, but this is pretty solid. I use it for creating tickets for missing apps.

    couple this together with eventlog sets to trigger tickets. set your event logs to watch for "event ID= 4 source = WSH description = "*Ticket Trigger*" the event log comes in as informational, if you'd like it to be something else it's not hard to change.

    The Kaseya script would just write the .exe to the PC and run it, the event log monitor will trigger a ticket if something is missing, and the event will list the app missing which will show in the ticket.

    for those who don't want to deal with any portion of this but think it could be usuful let me know and I'll modify the script to go to a vendor nutral area and re-post. From there you can compile with Autoit with your branding and it'll work just fine too. I just like everything in my Agent temp folder, makes it easy to clean up after.

    down to business: use Autoit ver 3 to compile this into an excuatible and it'll run on any windows system. Autoit also comes with a nice IDE tool to help edit the scripts. You can even attach your company Icon to it too (I've done it, it's easy).

    now in the script after "Dim $sTest" put in all the strings you want to match from Add Remove in the array. the script dumps the file into a csv file if you want to check on them to see what they look like, it also includes version numbers of the app. you'll also want to modify the file locations in 2 places for where the csv file get's dumped. search the text for "agent temp drive" and replace with your agent temp location. You'll also notice that "Global $sRite[20]" array is only for 20 slots, and I have an 'IF' statment with @CRLF in it. If you need more then 20 name lookups you'll have to increase the number in brackets. The more things you look up the more @CRLF's you'll need etc.etc.etc..... I added that peice in b/c if the @CRLF's don't equal the amount in $eVentLog then you'll get an event id with a lot of spaces if none of the strings are missing.

    In general, if you need some help with this script (and b/c I'm too tired to continue to explain in this post) just let me know, I don't mind helping you out......

    send me a message to my account in the forums or something

  • @swagner = services linked to login accounts script ...... are you looking to list specific services, do you want all the services? How would you like to view them, in a csv file, text file, script log, etc......   I think the best way if scanning all of the services on a box is to view in a csv so that you can open in excel with field headers.

  • 'Vbscript for creating a csv dump of all properties for services on a machine.



    Const ForAppending = 8
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objLogFile = objFSO.OpenTextFile("c:\support\service_list.csv", ForAppending, True)
    objLogFile.Write _
        ("System Name,Service Name,Service Type,Service State, Exit " _
            & "Code,Process ID,Can Be Paused,Can Be Stopped,Caption," _
            & "Description,Can Interact with Desktop,Display Name,Error " _
            & "Control, Executable Path Name,Service Started," _
            & "Start Mode,Account Name ")
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colListOfServices = objWMIService.ExecQuery _
            ("Select * from Win32_Service")
    For Each objService in colListOfServices
        objLogFile.Write(objService.SystemName) & ","
        objLogFile.Write(objService.Name) & ","
        objLogFile.Write(objService.ServiceType) & ","
        objLogFile.Write(objService.State) & ","
        objLogFile.Write(objService.ExitCode) & ","
        objLogFile.Write(objService.ProcessID) & ","
        objLogFile.Write(objService.AcceptPause) & ","
        objLogFile.Write(objService.AcceptStop) & ","
        objLogFile.Write(objService.Caption) & ","
        objLogFile.Write(objService.Description) & ","
        objLogFile.Write(objService.DesktopInteract) & ","
        objLogFile.Write(objService.DisplayName) & ","
        objLogFile.Write(objService.ErrorControl) & ","
        objLogFile.Write(objService.PathName) & ","
        objLogFile.Write(objService.Started) & ","
        objLogFile.Write(objService.StartMode) & ","
        objLogFile.Write(objService.StartName) & ","

    [edited by: danrche at 9:45 AM (GMT -8) on 1-28-2011] descriptor added.
  • save the above as a .vbs file, it'll dump the full list in csv format in c:\support\service_list.csv  

    so you can create a kaseya script that writes this to your Atemp folder, runs it, then collect the csv file with get file or get file content and write to where ever you like. If you look in the csv file one of the field headers are "StartName" that's the account listed/tied to that service.

    Hope this helps or at least is what you're looking for. If you want to search for specific's you'll need to modify this with an If statement and string test.