![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | win32_product uninstall method I am trying to learn how to call WMI methods in PowerShell, in this case the win32_product Uninstall method. So far, none of the information I've found has worked. I've tried 3 methods (I have substituted programname for the desired program): 1) $pc = Get-WmiObject -query "SELECT * FROM Meta_Class WHERE __Class='Win32_Product'" $pc.uninstall("programname") this one returns the error "Method invocation failed because [System.Management.ManagementClass#ROOT\cimv2\Win32_Product] doesn't contain a method named 'uninstall'. 2) various iterations of the script found here: Getting the class, not instances, with Get-WMIObject? all attempts with this also returned something along the lines of the error above, regardless of whether I tried the install or uninstall method. 3) $prog = Get-WmiObject -class win32_product -computername $cmp | Where-Object { $_.name -match "programname" } $prog.uninstall but this returns MemberType : Method OverloadDefinitions : {System.Management.ManagementBaseObject Uninstall()} TypeNameOfValue : System.Management.Automation.PSMethod Value : System.Management.ManagementBaseObject Uninstall() Name : Uninstall IsInstance : True Any ideas? Thanks Dav |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: win32_product uninstall method Try to using $prog.uninstall() to invoke the method. -- greetings dreeschkind "Bayer, David" wrote: > I am trying to learn how to call WMI methods in PowerShell, in this case the > win32_product Uninstall method. So far, none of the information I've found > has worked. I've tried 3 methods (I have substituted programname for the > desired program): > 1) > $pc = Get-WmiObject -query "SELECT * FROM Meta_Class WHERE > __Class='Win32_Product'" > $pc.uninstall("programname") > > this one returns the error "Method invocation failed because > [System.Management.ManagementClass#ROOT\cimv2\Win32_Product] doesn't contain > a method named 'uninstall'. > > 2) > various iterations of the script found here: > Getting the class, not instances, with Get-WMIObject? > > all attempts with this also returned something along the lines of the error > above, regardless of whether I tried the install or uninstall method. > > 3) > $prog = Get-WmiObject -class win32_product -computername $cmp | Where-Object > { $_.name -match "programname" } > $prog.uninstall > > but this returns > MemberType : Method > OverloadDefinitions : {System.Management.ManagementBaseObject Uninstall()} > TypeNameOfValue : System.Management.Automation.PSMethod > Value : System.Management.ManagementBaseObject Uninstall() > Name : Uninstall > IsInstance : True > > > Any ideas? > > Thanks > Dav > > |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: win32_product uninstall method Doh! Amazing the difference that a little syntax will make... It's working now - Thanks! Dav "dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message news:4CA50EFC-780C-443C-B839-79231A580EA1@microsoft.com... > Try to using $prog.uninstall() to invoke the method. > > -- > greetings > dreeschkind > > > "Bayer, David" wrote: > >> I am trying to learn how to call WMI methods in PowerShell, in this case >> the >> win32_product Uninstall method. So far, none of the information I've >> found >> has worked. I've tried 3 methods (I have substituted programname for the >> desired program): >> 1) >> $pc = Get-WmiObject -query "SELECT * FROM Meta_Class WHERE >> __Class='Win32_Product'" >> $pc.uninstall("programname") >> >> this one returns the error "Method invocation failed because >> [System.Management.ManagementClass#ROOT\cimv2\Win32_Product] doesn't >> contain >> a method named 'uninstall'. >> >> 2) >> various iterations of the script found here: >> Getting the class, not instances, with Get-WMIObject? >> >> all attempts with this also returned something along the lines of the >> error >> above, regardless of whether I tried the install or uninstall method. >> >> 3) >> $prog = Get-WmiObject -class win32_product -computername $cmp | >> Where-Object >> { $_.name -match "programname" } >> $prog.uninstall >> >> but this returns >> MemberType : Method >> OverloadDefinitions : {System.Management.ManagementBaseObject >> Uninstall()} >> TypeNameOfValue : System.Management.Automation.PSMethod >> Value : System.Management.ManagementBaseObject Uninstall() >> Name : Uninstall >> IsInstance : True >> >> >> Any ideas? >> >> Thanks >> Dav >> >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Method invocation failed because [System.String] doesn't contain a method | B Williams | PowerShell | 0 | 03-31-2008 06:00 PM |
| Create log file using Win32_Product Install() method | Flea# | PowerShell | 1 | 01-16-2008 04:05 PM |
| win32_product not valid | Frank | PowerShell | 3 | 05-12-2007 05:10 PM |
| Get-WmiObject Win32_Product | Keith Hill | PowerShell | 6 | 02-26-2007 02:21 PM |
| WMI Object Win32_Product and Pipeline woes | machone3720 | PowerShell | 3 | 08-29-2006 09:05 AM |