what's the UNC path for local computer from a remote machine ?

Posted by KaluSingh Gabbar on Stack Overflow See other posts from Stack Overflow or by KaluSingh Gabbar
Published on 2010-04-29T04:46:15Z Indexed on 2010/04/29 5:07 UTC
Read the original article Hit count: 261

Filed under:
|
|
|
|

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)
scope.Connect()

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() 

PROBLEM :

[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"] = ??

© Stack Overflow or respective owner

Related posts about Windows

Related posts about wmi