WMIC command to read registry Uninstall keys ...

Posted: 01-11-2005, 11:04 PM
I'm trying to get a more accurate list from WMIC than from the "wmic
product list brief". I'd like to simply read all the registry keys
under
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Cur rentVersion\Uninstall",
but I can't figure out how to navigate to that key using "WMIC
REGISTRY"! Documentation on the internet is really scarce and the only
examples I can find list NO useful information for navigating the
registry using WMIC.

I'm new to both WMIC and WMI, so that may be why I'm hitting this wall.

By the way, I'm hoping for a fully WMIC command, not any vb script or
WMI commands (there are a lot of those on the internet already). It
should be possible with one line of code in WMIC to accomplish this.
Thanks!

Reply With Quote

Responses to "WMIC command to read registry Uninstall keys ..."

Joe
Guest
Posts: n/a
 
WMIC command to read registry Uninstall keys ...
Posted: 01-12-2005, 12:04 AM
I'm trying to get a more accurate list from WMIC than from the "wmic
product list brief". I'd like to simply read all the registry keys
under
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Cur rentVersion\Uninstall",
but I can't figure out how to navigate to that key using "WMIC
REGISTRY"! Documentation on the internet is really scarce and the only
examples I can find list NO useful information for navigating the
registry using WMIC.

I'm new to both WMIC and WMI, so that may be why I'm hitting this wall.

By the way, I'm hoping for a fully WMIC command, not any vb script or
WMI commands (there are a lot of those on the internet already). It
should be possible with one line of code in WMIC to accomplish this.
Thanks!

Reply With Quote
tmartin1994
Guest
Posts: n/a
 
RE: WMIC command to read registry Uninstall keys ...
Posted: 01-25-2005, 05:35 AM
Not totally what you are looking for, but here IS a vbscript that could do
what you are asking. The script deletes all keys below a specified root-key
(Software\Microsoft\SMS). You would need to modify it a little to only READ
each key and dump the values in a text-file.

God Bless You!!

::::::::::::::::::::::::
Start of VBscript
::::::::::::::::::::::::

'Const HKEY_CLASSES_ROOT = &H80000000
'Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
'Const HKEY_USERS = &H80000003
Const ForReading = 1, ForWriting = 2, ForAppending = 8 'Used for
opening/creating/modifying text-files

Set objArgs = WScript.Arguments 'Create object to capture command-line
arguments into an object,
'for later use as a variable.
strSecondarySiteServer = objArgs(0) 'Sets/Initialize variable to first
command-line parameter which is
'the server-list

' Object used to get StdRegProv Namespace
Set wmiLocator = CreateObject("WbemScripting.SWbemLocator")

' Registry Provider (StdRegProv) lives in root\deafult namespace.
Set wmiNameSpace = wmiLocator.ConnectServer (strSecondarySiteServer,
"root\default")
Set objRegistry = wmiNameSpace.Get ("StdRegProv")

' Example Deletion of Value
sPath1 = "SOFTWARE\MICROSOFT\NAL"

'lRC = DeleteRegEntry(HKEY_LOCAL_MACHINE, sPath)
lRC = DeleteRegEntry(HKEY_LOCAL_MACHINE, sPath1)


sPath2 = "SOFTWARE\MICROSOFT\SMS"

lRC = DeleteRegEntry(HKEY_LOCAL_MACHINE, sPath2)

'objOutputFile.Writeline vbCrlf

Function DeleteRegEntry(sHive, sEnumPath)

' Attempt to delete key. If it fails, start the subkey
' enumration process.

lRC = objRegistry.DeleteKey(sHive, sEnumPath)

Select Case lRC

Case 0
'Registry key successfully deleted
Case 2
'Registry key does not exist
Case Else
' Subkey Enumerator
On Error Resume Next
lRC = objRegistry.EnumKey(sHive, sEnumPath, sNames)

For Each sKeyName In sNames

If Err.Number <> 0 Then
Exit For
End If

lRC = DeleteRegEntry(sHive, sEnumPath & "\" & sKeyName)

Next

On Error Goto 0

' At this point we should have looped through all subkeys, trying
' to delete the registry key again.
lRC = objRegistry.DeleteKey(sHive, sEnumPath)

End Select

End Function


::::::::::::::::::::::::
End of VBscript
::::::::::::::::::::::::



"Joe" wrote:
> I'm trying to get a more accurate list from WMIC than from the "wmic
> product list brief". I'd like to simply read all the registry keys
> under
> "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Cur rentVersion\Uninstall",
> but I can't figure out how to navigate to that key using "WMIC
> REGISTRY"! Documentation on the internet is really scarce and the only
> examples I can find list NO useful information for navigating the
> registry using WMIC.
>
> I'm new to both WMIC and WMI, so that may be why I'm hitting this wall.
>
> By the way, I'm hoping for a fully WMIC command, not any vb script or
> WMI commands (there are a lot of those on the internet already). It
> should be possible with one line of code in WMIC to accomplish this.
> Thanks!
>
>
Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
registry cleanup after Difficult Trend Micro PC-cillin uninstall Spirefm Windows Vista Performance & Maintenance 3 09-29-2006 05:35 PM
Error accessing registry keys even with administrator priveleges Pushkar Windows Vista Security 2 07-26-2006 08:14 PM
copy through WMIC Vend Windows XP WMI 1 01-07-2005 04:26 PM
Limit's of WMIC: 2nd Post Jacob Loveless Windows XP WMI 0 11-08-2004 10:26 PM
Registry Data Read Error? Ellen Windows XP Accessibility 0 07-03-2003 03:38 AM