JohnRichard Posted August 25, 2008 Share Posted August 25, 2008 good day everyone. i have this script which will list all the installed software on the remote computer. it has an inputbox asking for computer name. my problem is, how will i query only a specific software. Let's say i wanted to check if WinZIP installed or not. here is my the code: please need your help with this. #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 Link to comment Share on other sites More sharing options...
Danny35d Posted August 25, 2008 Share Posted August 25, 2008 expandcollapse popup#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($strComputer, 'winzip') _ArrayDisplay($return, "Installed Programs") Func _SoftwareInfo($computer = '', $sSoftwareName = '') Local $Count = 0 If $computer <> '' Then $computer = '\\' & StringReplace($computer, '\', '') & '\' Local Const $regkey = $computer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' While 1 $Count += 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] If $sSoftwareName <> '' And StringInStr($line, $sSoftwareName) = 0 Then ContinueLoop ReDim $avArray[UBound($avArray) + 1] $avArray[UBound($avArray) - 1] = $line EndIf 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 ;==>_SoftwareInfo AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Andreik Posted August 25, 2008 Share Posted August 25, 2008 expandcollapse popup#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() $software_name = InputBox("Select software","Type here a name of software","WinZIP") $result = _ArraySearch($return,$software_name) If @error Then MsgBox(0,$software_name,"Not Installed") Else MsgBox(0,$software_name,"Installed") EndIf 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 When the words fail... music speaks. Link to comment Share on other sites More sharing options...
rasim Posted August 25, 2008 Share Posted August 25, 2008 (edited) JohnRichardDon`t cross post! Edited August 25, 2008 by rasim Link to comment Share on other sites More sharing options...
JohnRichard Posted August 27, 2008 Author Share Posted August 27, 2008 wow that a quick response. it works! i should have been read on _ARRAYSEARCH and _ARRAYDISPLAY. thank you very much for the help. Link to comment Share on other sites More sharing options...
JohnRichard Posted August 27, 2008 Author Share Posted August 27, 2008 oops. i thought somebody will not look into my post so i posted a new. Link to comment Share on other sites More sharing options...
JohnRichard Posted August 27, 2008 Author Share Posted August 27, 2008 i wanted now to revert the array display. this time it will query all computer in our network with the specific installed program. say i want to query computers in our domain with no WinZIP or Symantec Endpoint. Link to comment Share on other sites More sharing options...
rasim Posted August 27, 2008 Share Posted August 27, 2008 JohnRichardExample:expandcollapse popup#include <Array.au3> Local $strComputer, $strInput $strComputer = (InputBox("List software","Enter COMPUTER NAME to query list of installed programs.")) If $strComputer = '' Then $strComputer = "\\" & @ComputerName & "\" ;current computer Else $strComputer = "\\" & $strComputer & "\" EndIf $return = _SoftwareInfo($strComputer) ;_ArrayDisplay($return, "Installed Programs") $qWinZIP = False $qSymantec = False If _ArraySearch($return, "WinZip", 1) <> -1 Then $qWinZIP = True If _ArraySearch($return, "Symantec Endpoint", 1) <> -1 Then $qSymantec = True MsgBox(0, "WinZip", "Installed = " & $qWinZIP) MsgBox(0, "Symantec Endpoint", "Installed = " & $qSymantec) Func _SoftwareInfo($computer = $strComputer) Local Const $regkey = $computer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' Local $key, $Count = 0, $avArray[1] While 1 $Count = $Count + 1 $key = RegEnumKey($regkey, $Count) If @error Then ExitLoop $line = RegRead($regkey & '\' & $key, 'Displayname') If @error Then ContinueLoop $line = StringReplace($line, ' (remove only)', '') $avArray[0] += 1 ReDim $avArray[$avArray[0] + 1] $avArray[$avArray[0]] = $line WEnd Return $avArray EndFunc Link to comment Share on other sites More sharing options...
JohnRichard Posted August 28, 2008 Author Share Posted August 28, 2008 thanks. i appreciate it. but what i mean is that it will scan all computers in my domain. After scanning, it will give me an array for all the computers with no installed software like WinZIP or the Symantec. so how would i do scanning computers in my domain? 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