Take the 2-minute tour ×

I am writing a small utility program in IronPython to install applications on remote machine using managementclass which uses WMI.

Now, the script would install an application on Machine_B from Machine_A, it works fine as long as you have the msi file on the local drive of the Target machine (Machine_B, in this case). I want to be able to do same thing with .msi file being on the Host (Machine_A) machine.

network_scope = r"\\%Machine_B\root\cimv2" 
scope =  ManagementScope(network_scope, options)

mp =  ManagementPath("Win32_Product")
ogo = ObjectGetOptions()
mc = ManagementClass(scope, mp, ogo)
inParams = mc.GetMethodParameters ("Install")
inParams["PackageLocation"] = r"C:\installs\python-3.1.1.msi"
inParams["AllUsers"] = True
retVal = mc.InvokeMethod ("Install", inParams, None)
print retVal ["ReturnValue"].ToString() 


[Machine A] --- Where I am running the script, and want to host the .msi file
[Machine B] --- where I want to install the application

So, How can I define the UNC path for local machine ? what will be inParams["PackageLocation"] = ??

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Why not have your script copy the file to the administrative share C$ of the target machine, then optionally delete it when done? Installing from a local .msi is much faster than over-the-network reads of the .msi database continually.

share|improve this answer
so, now the question is: in copy function, how do I put the path for local file, my Script would be executing on remote machine so it should be able to determine the path of local computer. \\machinename\drive\path does not work. Thanks ! –  Ramadheer Singh Apr 29 '10 at 5:13
It doesn't look like your script is executing on the remote machine. Your script is executing on MachineA and making a remote WMI request to MachineB. Anyway, \\machinename\sharename\path is the correct format, make sure sharing is enabled on MachineA, that MachineB's machine account has read access to the share and to the file, etc. –  Ben Voigt Apr 29 '10 at 22:24
add comment

Your Answer


