467,923 Members | 1,766 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,923 developers. It's quick & easy.

Problem with Win32_Product - Upgrade method -1636 error code

Hi all,

I am trying to do Software upgradation using Win32_Product -Upgrade method in C#.Net.

Here is the code.

using System;
using System.Management;
using System.Windows.Forms;

namespace WMISample
{
public class CallWMIMethod
{
public static void Main()
{
try
{
ManagementObject classInstance =
new ManagementObject("root\\CIMV2",
"Win32_Product.IdentifyingNumber='{AC76BA86-7AD7-1033-7B44-A00000000001}',Name='Adobe Reader 6.0.1',Version='006.000.001'",
null);

// Obtain in-parameters for the method
ManagementBaseObject inParams =
classInstance.GetMethodParameters("Upgrade");

// Add the input parameters.
inParams["PackageLocation"] = @"D:\softwares\upgradePatch.msi";

// Execute the method and obtain the return values.
ManagementBaseObject outParams =
classInstance.InvokeMethod("Upgrade", inParams, null);

// List outParams
Console.WriteLine("Out parameters:");
Console.WriteLine("ReturnValue: " + outParams["ReturnValue"]);
}
catch(ManagementException err)
{
MessageBox.Show("An error occurred while trying to execute the WMI method: " + err.Message);
}
}
}
}

When I run this code , I am getting 1636 error code, means the patch file is not correct.
But when I manually do the upgradation by double clicking on that msi file, upgradation is success. Then what is problem in this code. How to do it programatically. any suggessions plz........
Mar 21 '08 #1
  • viewed: 1337
Share:

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Salisha Khan | last post: by
4 posts views Thread by Dave Harney | last post: by
1 post views Thread by yasaswi | last post: by
4 posts views Thread by Mark | last post: by
3 posts views Thread by Robby | last post: by
5 posts views Thread by Brian Henry | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.