RegOwner and RegCompany Objects of Win32_Product Class

A

Avinash Deshpande

I am using RegOwner and RegCompany Objects of Win32_Product Class to get the
Product details of the Microsoft applications installed on my machine. I was
using the code below
StrComputer = "."
Function DispList(StrComputer)

DIM objFSO, objWMIService, colSoftware, objSoftware
Set objFSO = CreateObject("Scripting.FileSystemObject")

DIM OutputFile
DIM objFile

OutputFile = "D:\output.txt"

Set objFile = objFSO.CreateTextFile(OutputFile)

objFile.WriteLine "Software list for " & StrComputer

Set objWMIService = GetObject("winmgmts:\\" & StrComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product
where Name like 'Microsoft Office%'")
objFile.WriteLine "Name " & vbtab & "Version "
For Each objSoftware in colSoftware
objFile.WriteLine objSoftware.Name & "," & objSoftware.Version &
"," & objSoftware.RegCompany & "," & objSoftware.RegOwner
Next

Set objFile = Nothing
Set objFSO = Nothing
End function

When running the code i get error at RegOwner and RegCompany which says
"Object doesn't support this property or method "objSoftware.RegOwner" Error
Code: 800A01B6

Please let me know how can i get the details
 

My Computer

M

Mayayana

I don't see those properties listed in the WMI help,
and I don't see any such values under the Uninstall
key for software installed via MSI. I have the WMI v. 1
help and also the server 2003 version help.

Also see here:
http://msdn.microsoft.com/en-us/library/aa394378(VS.85).aspx

It looks like the property is new and therefore can't
be depended upon.

|I am using RegOwner and RegCompany Objects of Win32_Product Class to get
the
| Product details of the Microsoft applications installed on my machine. I
was
| using the code below
| StrComputer = "."
| Function DispList(StrComputer)
|
| DIM objFSO, objWMIService, colSoftware, objSoftware
| Set objFSO = CreateObject("Scripting.FileSystemObject")
|
| DIM OutputFile
| DIM objFile
|
| OutputFile = "D:\output.txt"
|
| Set objFile = objFSO.CreateTextFile(OutputFile)
|
| objFile.WriteLine "Software list for " & StrComputer
|
| Set objWMIService = GetObject("winmgmts:\\" & StrComputer &
"\root\cimv2")
| Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product
| where Name like 'Microsoft Office%'")
| objFile.WriteLine "Name " & vbtab & "Version "
| For Each objSoftware in colSoftware
| objFile.WriteLine objSoftware.Name & "," & objSoftware.Version &
| "," & objSoftware.RegCompany & "," & objSoftware.RegOwner
| Next
|
| Set objFile = Nothing
| Set objFSO = Nothing
| End function
|
| When running the code i get error at RegOwner and RegCompany which says
| "Object doesn't support this property or method "objSoftware.RegOwner"
Error
| Code: 800A01B6
|
| Please let me know how can i get the details
 

My Computer

A

Avinash Deshpande

Hi,

Thanks for your reply.

If you browse for the link that you provided kindly go through the page. At
the bottom of the page we can find the 2 properties that i had listed.

RegCompany
Data type: string
Access type: Read-only

The company registered to use the product.

Windows Server 2003, Windows XP, and Windows 2000: This property is not
available.
RegOwner
Data type: string
Access type: Read-only

The owner registered to use the product.

Windows Server 2003, Windows XP, and Windows 2000: This property is not
available.

"Mayayana" wrote:

> I don't see those properties listed in the WMI help,
> and I don't see any such values under the Uninstall
> key for software installed via MSI. I have the WMI v. 1
> help and also the server 2003 version help.
>
> Also see here:
> http://msdn.microsoft.com/en-us/library/aa394378(VS.85).aspx
>
> It looks like the property is new and therefore can't
> be depended upon.
>
> |I am using RegOwner and RegCompany Objects of Win32_Product Class to get
> the
> | Product details of the Microsoft applications installed on my machine. I
> was
> | using the code below
> | StrComputer = "."
> | Function DispList(StrComputer)
> |
> | DIM objFSO, objWMIService, colSoftware, objSoftware
> | Set objFSO = CreateObject("Scripting.FileSystemObject")
> |
> | DIM OutputFile
> | DIM objFile
> |
> | OutputFile = "D:\output.txt"
> |
> | Set objFile = objFSO.CreateTextFile(OutputFile)
> |
> | objFile.WriteLine "Software list for " & StrComputer
> |
> | Set objWMIService = GetObject("winmgmts:\\" & StrComputer &
> "\root\cimv2")
> | Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product
> | where Name like 'Microsoft Office%'")
> | objFile.WriteLine "Name " & vbtab & "Version "
> | For Each objSoftware in colSoftware
> | objFile.WriteLine objSoftware.Name & "," & objSoftware.Version &
> | "," & objSoftware.RegCompany & "," & objSoftware.RegOwner
> | Next
> |
> | Set objFile = Nothing
> | Set objFSO = Nothing
> | End function
> |
> | When running the code i get error at RegOwner and RegCompany which says
> | "Object doesn't support this property or method "objSoftware.RegOwner"
> Error
> | Code: 800A01B6
> |
> | Please let me know how can i get the details
>
>
> .
>
 

My Computer

M

Mayayana

|
| If you browse for the link that you provided kindly go through the page.
At
| the bottom of the page we can find the 2 properties that i had listed.
|

Yes, that's what I meant. It's there, but:
|
| Windows Server 2003, Windows XP, and Windows 2000: This property is not
| available.

You didn't say what system you're using. If you're
not using Vista/7 then you apparently can't use
the properties.

Win32_Product is actually just a partial wrapper around
the WindowsInstaller.Installer object. (It only sees software
installed via MSI.) But RegOwner and
RegCompany sound like add-ons. In other words, reg.
information entered during install is not normally part or
either WMI or MSI. So I'd guess that Vista/7 have somehow
standardized a method to store that info. in the Registry,
and that WMI is retrieving it from there.

Looking in XP I find this:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData

Even though WMI/MSI in XP doesn't have the RegOwner and
RegCompany properties, they can be found in subkeys
there. There's one problem, though. In my own case, the
only software I ever entered my name into during install
was VS6. Yet most of the software I have under that key
has my name. It was stolen from the VS Registry entries
here:

HKEY_CURRENT_USER\Software\Microsoft\MS Setup (ACME)

So there are three minor drawbacks to be aware of: 1) What
you want is only available with MSI installs. 2) The info. itself
is not dependable. [Though of course it never is, anyway. No one
has to enter true info.] 3) Prior to Vista/7 you'll probably have to
dig in the Registry to find it.
 

My Computer

A

Avinash Deshpande

Hi,

Thanks. I am using Windows XP and i was trying to get the information for
all the Microsoft Products that are installed on my PC and on Network PCs.

Do we have any VB script which will get the information?

"Mayayana" wrote:

> |
> | If you browse for the link that you provided kindly go through the page.
> At
> | the bottom of the page we can find the 2 properties that i had listed.
> |
>
> Yes, that's what I meant. It's there, but:
> |
> | Windows Server 2003, Windows XP, and Windows 2000: This property is not
> | available.
>
> You didn't say what system you're using. If you're
> not using Vista/7 then you apparently can't use
> the properties.
>
> Win32_Product is actually just a partial wrapper around
> the WindowsInstaller.Installer object. (It only sees software
> installed via MSI.) But RegOwner and
> RegCompany sound like add-ons. In other words, reg.
> information entered during install is not normally part or
> either WMI or MSI. So I'd guess that Vista/7 have somehow
> standardized a method to store that info. in the Registry,
> and that WMI is retrieving it from there.
>
> Looking in XP I find this:
>
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData
>
> Even though WMI/MSI in XP doesn't have the RegOwner and
> RegCompany properties, they can be found in subkeys
> there. There's one problem, though. In my own case, the
> only software I ever entered my name into during install
> was VS6. Yet most of the software I have under that key
> has my name. It was stolen from the VS Registry entries
> here:
>
> HKEY_CURRENT_USER\Software\Microsoft\MS Setup (ACME)
>
> So there are three minor drawbacks to be aware of: 1) What
> you want is only available with MSI installs. 2) The info. itself
> is not dependable. [Though of course it never is, anyway. No one
> has to enter true info.] 3) Prior to Vista/7 you'll probably have to
> dig in the Registry to find it.
>
>
>
>
> .
>
 

My Computer

M

Mayayana

| Thanks. I am using Windows XP and i was trying to get the information for
| all the Microsoft Products that are installed on my PC and on Network PCs.
|
| Do we have any VB script which will get the information?

The only thing I can suggest is to do what WMI/MSI
does: read the Registry. If you look in

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData

you'll see that the subkeys are user code IDs. Under each of those
is a Products key. Under that are a number of keys with random numbers.
Each represents something installed with an MSI. If you then look in
the InstallProperties key under that you'll find what you need. The
Publisher
value can be checked to weed out non-MS software. RegCompany and
RegOwner values are there. And DisplayName appears to be what shows in
Add/Remove.

WScript.Shell can read the Registry but it can't enumerate
subkeys. If you want a class that can do that see here:

http://www.jsware.net/jsware/scripts.php5#wmirclas

It's a VBScript class that wraps the WMI StdRegProv. Unlike
VBS, StdRegProv can do all basic Registry functions, but
the object model is clunky and very poorly designed. The
linked class provides a way to bypass the StdRegProv mess
and just use sensible functions like GetValue, EnumerateKeys,
etc.

What you want to do seems pretty straightforward, except
for getting the right user ID key. I don't know offhand how one
identifies the ID of the current user.
 

My Computer

Top