![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| | |||||||
| | Vista - InvokeMethod - Method Failure |
| |
| 01-02-2007 | #1 |
| | InvokeMethod - Method Failure Hi there, When using the install Application example in the 'Windows Powershell Primer' Pg. 93 (get-wmiobject -Computername <MachineName> -List | where-object -filterscript {$_.Name -eq "Win32_Product"}).InvokeMethod("Install","\\<Server>\<Share>\<FileName>.msi") I get the error. Method invocation failed because [System.Management.ManagementClass#ROOT\cimv2\Win32_Product] doesn't contain a method named 'InvokeMethod'. At line:1 char:124 Anyone encountered this error? Thanks, jtsm |
| My System Specs |
| 01-02-2007 | #2 |
| | Re: InvokeMethod - Method Failure Hi, There appears to be a problem with the documentation. Can you open a bug on this issue at connect (http://connect.microsoft.com)? To install an application using Win32_Product WMI class do the following: ([wmiclass]"win32_product").Install(<packagelocation>) 1. [wmiclass]"win32_product" will return an object of Type System.Management.ManagementClass (with WMI classname = "win32_product") PS C:\Documents and Settings\kriscv> $w32p = ([wmiclass]"win32_product") PS C:\Documents and Settings\kriscv> $w32p | gm TypeName: System.Management.ManagementClass#ROOT\cimv2\Win32_Product 2. Powershell engine adapts objects of type System.Management.ManagementClass..and makes the properties/methods of the underlying WMI class immediately available to the user. PS C:\Documents and Settings\kriscv> $w32p | gm TypeName: System.Management.ManagementClass#ROOT\cimv2\Win32_Product Name MemberType Definition ---- ---------- ---------- Admin Method System.Management.ManagementBaseObject Admin(System.String PackageLocation, System.Strin... Advertise Method System.Management.ManagementBaseObject Advertise(System.String PackageLocation, System.S... Install Method System.Management.ManagementBaseObject Install(System.String PackageLocation, System.Str... 3. To get original .net properties/methods of the adapted object use "psbase" like PS C:\Documents and Settings\kriscv> $w32p.psbase.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True ManagementClass System.Management.ManagementObject The following blog posts might help you understanding WMI support in PowerShell http://blogs.msdn.com/powershell/arc...26/647038.aspx http://mow001.blogspot.com/2006/10/p...c2-series.html -- Thanks Krishna[MSFT] Windows PowerShell Team Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "jtsm" <jtsm@discussions.microsoft.com> wrote in message news:04373A64-A1FD-46CF-ABA0-4CE317225A19@microsoft.com... > Hi there, > > When using the install Application example in the 'Windows Powershell > Primer' Pg. 93 > > (get-wmiobject -Computername <MachineName> -List | where-object > -filterscript {$_.Name -eq > "Win32_Product"}).InvokeMethod("Install","\\<Server>\<Share>\<FileName>.msi") > > I get the error. > Method invocation failed because > [System.Management.ManagementClass#ROOT\cimv2\Win32_Product] doesn't > contain > a method named 'InvokeMethod'. > At line:1 char:124 > > Anyone encountered this error? > > Thanks, > jtsm > |
| My System Specs |
| 01-02-2007 | #3 |
| | Re: InvokeMethod - Method Failure 1) Just get rid o fthe InvokeMethod and call Install directly. 2) Consider doing it this way: PS> ([wmiclass]"\\<Machine Name>\root\cimv2:win32_product").Install("\\<Server>\<Share>\<FileName>.msi") -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. |
| My System Specs |
| 01-03-2007 | #4 |
| | Re: InvokeMethod - Method Failure Thanks guys, I've replace the invoke. These appear to work fine from the local machine and will install. But fail to install when trying to remotely install an MSI. |
| My System Specs |
![]() |
| Thread Tools | |
| |
| Similar Threads for: InvokeMethod - Method Failure | ||||
| Thread | Forum | |||
| win32_service InvokeMethod fails. What am I doing wrong? | PowerShell | |||
| Method invocation failed because [System.String] doesn't contain a method | PowerShell | |||
| vista ultimate backup failure - shadow copy failure | Vista General | |||
| vista ultimate backup failure - shadow copy failure | Vista General | |||
| InvokeMethod Problem | PowerShell | |||