Different result for read subkeys from remotely regist.

kav205

New Member
Joined
Nov 4, 2016
Messages
2
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
[TABLE="width: 1700"]
<tbody>[TR]
[TD]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[/TD]
[/TR]
</tbody>[/TABLE]

2.Run vbs file
[TABLE="width: 1700"]
<tbody>[TR]
[TD]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[/TD]
[/TR]
</tbody>[/TABLE]


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?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top