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
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?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,216,732
Messages
6,132,409
Members
449,727
Latest member
Aby2024

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