havokex Posted August 12, 2010 Posted August 12, 2010 Hello, I've got a script which i got from this forum that allows me to query machines on the network and returns a list of programs installed on that system. However when I try to query a Windows 7 machine the script just stops without returning anything. Is there something I need to do different for windows 7? Here's the script: 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() _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 Thanks in advance.
FlyinRiz Posted August 12, 2010 Posted August 12, 2010 Might have something to do with permissions or maybe a 64bit issue...it might be HKLM64 instead of HKLM. Not sure.
havokex Posted August 12, 2010 Author Posted August 12, 2010 I checked the registry on the windows 7 machines(it is 64bit) but the key is still HKLM in there.
havokex Posted August 13, 2010 Author Posted August 13, 2010 So i found the solution to the problem. Didn't have to change anything in the script. Remote Registry Services was not started on the Win7 machine. Once that service was started the script ran fine.
Danny35d Posted August 15, 2010 Posted August 15, 2010 So i found the solution to the problem. Didn't have to change anything in the script. Remote Registry Services was not started on the Win7 machine. Once that service was started the script ran fine. Also for a 64bit Windows OS you need to check HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall register key. I use the script below, it give you an array of installed software from a 32bit or 64bit. #include <Array.au3> $List = _SoftwareList() _ArrayDisplay($List) Func _SoftwareList($RemoteComputer = '') $SoftwareList = '' Local $RegRootArch[2] = ["HKLM\SOFTWARE", "HKLM64\SOFTWARE"] Local $RegPath = "\Microsoft\Windows\CurrentVersion\Uninstall" If @OSArch = "X64" Then $RegRootArch[0] &= "\Wow6432Node" For $RegRoot In $RegRootArch $RegCount = 0 If $RemoteComputer <> '' Then $RegRoot = '\\' & StringReplace($RemoteComputer, '\', '') & '\' & $RegRoot While 1 $RegCount += 1 $RegKey = RegEnumKey($RegRoot & $RegPath, $RegCount) If @error <> 0 Then ExitLoop $ThisRegValue = RegRead($RegRoot & $RegPath & '\' & $RegKey, 'Displayname') If $ThisRegValue <> '' Then $ThisRegValue = StringReplace($ThisRegValue, ' (remove only)', '') $SoftwareList &= $ThisRegValue & '|' EndIf WEnd If @OSArch = "X86" Then Return (StringSplit(StringTrimRight($SoftwareList, 1), '|')); <== We are done if OS Arch is x86 Next Return (StringSplit(StringTrimRight($SoftwareList, 1), '|')) EndFunc ;==>_SoftwareList AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
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