Hi. Sorry for my english.
I have two method for read subkeys from remotely registr with function EnumKey.
1. Run from VBA by office 2010
<tbody>
</tbody>
2.Run vbs file
<tbody>
</tbody>
Destination computer is Windows 7 x64. UAC disabled.
First method return 87 subkeys.
Second method return 66 subkeys. It is true value.
First method return value, that absent in remotely registr.
I need used both method.
What wrong in first method?
I have two method for read subkeys from remotely registr with function EnumKey.
1. Run from VBA by office 2010
Private Sub cmbReadSoft_Click() On Error Resume Next Dim strName, oReg, keyname Dim colS As Collection Dim arrSoftwareName() Dim arrSubKeys() Const HKEY_LOCAL_MACHINE = &H80000002 strComputer = Me.txtComputeName Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys I = 1 For Each strSubkey In arrSubKeys objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "" & strSubkey, "DisplayName", strNameValue objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "" & strSubkey, "DisplayVersion", strVersSoftValue objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "" & strSubkey, "UninstallString", strUninstallValue objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "" & strSubkey, "QuietUninstallString", strSilentValue |
<tbody>
</tbody>
2.Run vbs file
Dim strName Dim oReg Dim keyname Dim colS Dim arrSoftwareName() Dim arrSubKeys() If WScript.Arguments.Count() > 0 Then strComputer = WScript.Arguments(0) Else WScript.Echo("Формат вызова: ReadInstalledSoft.vbs <имя компьютера>!") End if Const HKEY_LOCAL_MACHINE = &H80000002 Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys Set wshShell = WScript.CreateObject("WScript.Shell") Set Fs = CreateObject("Scripting.FileSystemObject") sPath = wshShell.CurrentDirectory Set oOutFile = FS.CreateTextFile(sPath & "" & strComputer & ".csv") For Each strSubkey In arrSubKeys objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "" & strSubkey, "DisplayName", strNameValue objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "" & strSubkey, "DisplayVersion", strVersSoftValue objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "" & strSubkey, "UninstallString", strUninstallValue objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "" & strSubkey, "QuietUninstallString", strSilentValue oOutFile.WriteLine strSubkey & "," & strNameValue & "," & strVersSoftValue & "," & strUninstallValue & "," & strSilentValue Next |
<tbody>
</tbody>
Destination computer is Windows 7 x64. UAC disabled.
First method return 87 subkeys.
Second method return 66 subkeys. It is true value.
First method return value, that absent in remotely registr.
I need used both method.
What wrong in first method?