I want to install the MSI package on a remote computer. The local and remote computers are both members of a domain called "adn.lan", and the user / password that I pass as the connection parameter has full access to the remote machine. When I set connection.Authority to "ntdlmdomain: adran.lan" , the return parameter shows "Invalid parameter" and when I leave it as nullI do it I noticed that it connect()will connect successfully, but when it tries to install the package, the returned parameter shows that the address packet is not available.
Here is the code I tried with.
ConnectionOptions connection = new ConnectionOptions();
connection.Username = username;
connection.Password = password;
connection.Authentication = AuthenticationLevel.Packet;
ManagementScope scope = new ManagementScope("\\\\RemoteMachineName\\root\\CIMV2", connection);
scope.Connect();
ManagementPath p = new ManagementPath("Win32_Product");
ManagementClass classInstance = new ManagementClass(scope, p, null);
ManagementBaseObject inParams = classInstance.GetMethodParameters("Install");
inParams["AllUsers"] = true;
inParams["Options"] = string.Empty;
inParams["PackageLocation"] = "\\\\LocalMachineName\\Share\\Prescription.msi";
ManagementBaseObject outParams = classInstance.InvokeMethod("Install", inParams, null);
string retVal = outParams["ReturnValue"].ToString();
theconnection.Impersonation Identity, "Access denied".