Jump to content

Recommended Posts

Posted

Hi guys,

I am new in here. I was searching for software which will give me query of all installed programs on remote computer. I use below scripts and its work for me but I have I problem.

when I run this script I got list of program and windows updates and need to remove windows update from this list.

where and what I have to add in this script that it will give me just list of programs not windows updates

thanks a lot

SCRIPTS

#include <Array.au3>

#include <GUIConstantsEx.au3>

Local $strComputer, $strInput

Do

$strComputer = (InputBox("List software","Enter COMPUTER NAME to query list of installed programs."))

If $strComputer <> '' Then

$strInput = 1

EndIf

Until $strInput = 1

$return = _SoftwareInfo()

_ArrayDisplay($return, "Installed Programs")

Func _SoftwareInfo($computer = $strComputer)

Local $Count = 1

If $computer <> '' Then $computer = '\\' & StringReplace($computer, '\', '') & '\'

Local Const $regkey = $computer & '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[uBound($avArray) - 1] = $line

EndIf

$Count = $Count + 1

WEnd

If Not IsDeclared('avArray') Or Not IsArray($avArray) Then

Return(SetError(1, 0, ''))

Else

$avArray[0] = UBound($avArray) - 1

Return(SetError(0,0, $avArray))

EndIf

EndFunc

  • Moderators
Posted

Hi, saif5972, welcome to the forum. This is a very old script I used to use to enum the apps on a remote machine. It strips out anything that begins with "Security Update for" or "Hotfix for". I find that this catches about 95% of what I need to exclude. You may find something that assist you in what you're trying to do.

#include <Array.au3>
#include <File.au3>
AutoItSetOption("WinTitleMatchMode", 2)

Main()

Func Main()
   $Timer = TimerInit()
   $Computer = InputBox("Enumerate Remote Applications", "Please enter the computer you'd like to connect to.")
 
      If Ping($Computer) Then
         $addremove = _SoftwareInfo($Computer)
         _ArraySort($addremove, 0, 1)
         $Diff = TimerDiff($Timer)
         ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Diff = ' & $Diff & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
         _ArrayDisplay($addremove, 'Add/Remove Entries for ' & $Computer & '.')
         $var = MsgBox(4, "", "Would you like to search for another?")
            If $var = 6 Then
               Main()
            Else
               Exit
            EndIf
      Else
         $err = MsgBox(4, $Computer, "Could not ping computer. Would you like to search for another?")
            If $err = 6 Then
               Main()
            Else
               Exit
            EndIf
      EndIf
 
EndFunc
 
Func _SoftwareInfo($Computer)
   Local $Count = 1, $Count1 = 1
      If $Computer <> '' Then $Computer = '\\' & StringReplace($Computer, '\', '') & '\'
 
   Local Const $regkey = $Computer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
 
   While 1
      $key = RegEnumKey($regkey, $Count1)
         If @error <> 0 Then ExitLoop
      $line = RegRead($regkey & '\' & $key, 'Displayname')
         If $line <> '' Then
            If StringMid($line, 1, 19) <> "Security Update for" And StringMid($line, 1, 10) <> "Hotfix for" And StringMid($line, 1, 14) <> "Microsoft .Net" And StringMid($line, 1, 16) <> "Microsoft Office" And StringMid($line, 1, 7) <> "Altiris" And StringMid($line, 1, 10) <> "Update for" And StringMid($line, 1, 13) <> "Windows Media" Then
               If Not IsDeclared('avArray') Then Dim $avArray[100]
               If UBound($avArray) - $Count <= 1 Then ReDim $avArray[UBound($avArray) + 100]
                  $avArray[$Count] = $line
                  $Count = $Count + 1
           EndIf
        EndIf
    
      $Count1 += 1
WEnd
 
   If Not IsDeclared('avArray') Or Not IsArray($avArray) Then
     Return (SetError(1, 0, ''))
   Else
     ReDim $avArray[$Count - 1]
     $avArray[0] = UBound($avArray) - 1
     _FileWriteFromArray("C:\Apps.txt", $avArray)
     Return (SetError(0, 0, $avArray))
   EndIf
 
EndFunc

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

saif5972,

When posting AutoIt please use the [autoit][/autoit] tags, as it makes it more user friendly to read. Thanks.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted

JLogan3o13 u r best and u make my life easy bro its work for me like a ghost

this was my first time and now I will read more about this software

thanks aloooot again n again

and also thanks Guinness

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
×
×
  • Create New...