|
Replies:
5
-
Pages:
1
-
Last Post:
Jun 29, 2007 5:14 AM
by: /\/\o\/\/
|
|
|
Posts:
6
From:
San Francisco
Registered:
11/27/06
|
|
|
|
WMI example for add/remove programs does not work ?
Posted:
Dec 4, 2006 6:02 PM
|
|
PS D:\mydir> get-wmiobject -class "win32reg_addremoveprograms" -namespace "root\cimv2" |select-object -property DisplayName
results in:
Get-WmiObject : Invalid class At line:1 char:14 + get-wmiobject <<<< -class "win32reg_addremoveprograms" -namespace "root\cimv 2" |select-object -property DisplayName PS D:\prime\BuildServerScripts>
|
|
Posts:
1
From:
Portland
Registered:
3/31/07
|
|
|
|
Re: WMI example for add/remove programs does not work ?
Posted:
Mar 31, 2007 3:07 PM
in response to:
amol_deshpande
|
|
Yeah, I get the same error.
|
|
Posts:
2
From:
Australia
Registered:
4/10/07
|
|
|
|
Re: WMI example for add/remove programs does not work ?
Posted:
Apr 10, 2007 7:26 AM
in response to:
murk_johansen
|
|
i can find 3 class in that namespace that contain the word 'add' -- and none of them is the one we're after.
get-wmiobject -namespace "root\CIMV2" -list | where {$_.__CLASS -like '*add*'}
returns Win32_DeviceMemoryAddress Win32_PerfRawData_PerfProc_ProcessAd... Win32_PerfFormattedData_PerfProc_Pro...
but no 'addremoveprograms'
it's fun to tinker though
|
|
Posts:
1
From:
USA
Registered:
6/26/07
|
|
|
|
Re: WMI example for add/remove programs does not work ?
Posted:
Jun 26, 2007 9:51 AM
in response to:
amol_deshpande
|
|
According to a posting in the microsoft.public.windows.powershell users group you need System Management Server (SMS) software from Microsoft to use the Win32_addremomeprograms class. I found some information on SMS by doing a Google search. However the instruction for installing the sofwate were confusing so I didn't waste any more time trying to install SMS server and client software.
Howard
|
|
Posts:
24
From:
Canada
Registered:
3/5/07
|
|
|
|
Re: WMI example for add/remove programs does not work ?
Posted:
Jun 28, 2007 2:20 PM
in response to:
hrh1818
|
|
/\/\o\/\/ posted in the PowerShell newsgroup on how to create that WMI "class" manually.
|
|
Posts:
5
From:
The Netherlands
Registered:
9/20/06
|
|
|
|
Re: WMI example for add/remove programs does not work ?
Posted:
Jun 29, 2007 5:14 AM
in response to:
marco.shaw
|
|
F.Y.C.
Here is the code to create the WMI class manualy as posted in the NG I changed classname to win32_reg_ARP for this example ( as I have SMS ) :
###
set-content RegProgs.mof @' #pragma namespace("\\\\.\\root\\cimv2") instance of __Win32Provider as $Instprov { Name ="RegProv" ; ClsID = "{fe9af5c0-d3b6-11ce-a5b6-00aa00680c3f}" ; }; instance of __InstanceProviderRegistration { Provider =$InstProv; SupportsPut =TRUE; SupportsGet =TRUE; SupportsDelete =FALSE; SupportsEnumeration = TRUE; };
[dynamic, provider("RegProv"), ProviderClsid("{fe9af5c0-d3b6-11ce-a5b6-00aa00680c3f}"),ClassContext("local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall")] class win32reg_ARP { [key] string ProdID; [PropertyContext("DisplayName")] string DisplayName; [PropertyContext("Publisher")] string Publisher; [PropertyContext("DisplayVersion")] string Version; };
'@
mofcomp.exe RegProgs.mof
get-wmiobject Win32reg_arp
###
Enjoy, Greetings /\/\o\/\/ http://thePowerShellGuy.com
|
|
|
Legend
|
|
Gold: 300
+
pts
|
|
Silver: 100
- 299
pts
|
|
Bronze: 25
- 99
pts
|
|
Manning Author
|
|
Manning Staff
|
|