siddhartha veedaluru wrote:
Sorry about the confusing question.
Your rewording is a lot clearer. Thanks.
Here is what i want to achieve i have certain updates that i need to install on different machines These updates are placed in a location and is mapped to all the machines
While I think I know what you mean, the last part of this sentence actually doesn't make very much sense. You can share a folder on a Windows machine and you can access that shared folder from another Windows machine, but the concept of mapping [a drive] is a logon-specific one. The machine doesn't have a drive mapping: a user does.
There will be an exe file say "InstallUpdate.exe" for every update. i need to run this exe on all the machines. i tried running the exe using the following code
[... snip code ...] The simplest thing, assuming that the orcl\Administrator account has both share-security and file-security access to the .exe is to use the UNC location, which bypasses the issues of drive mapping. As a second hint, there's no need to do the two-line dance to connect to the remote server with credentials. The WMI module can do that for you. <rewritten code - untested> import wmi c = wmi.WMI ("orcl", user="Administrator", password="boss") command = r"cmd /c \\svr\share\update01\installupdate.exe > c:\sid.txt" pid, result = c.Win32_Process.Create (CommandLine=cmd) if result != 0: print "Update failed with", result else: print "Update succeeded" </rewritten code> Note that the signature of the Win32_Process.Create method... <snippet> import wmi print wmi.WMI ().Win32_Process.Create </snippet> ... suggests that you need SeAssignPrimaryToken and SeIncreaseQuotaPrivilege enabled. It may be that the session will have these anyway, but if not you'll need to specify them as part of the connection.
2) Also is there any way i get back the result of the command executed or i can only redirect it to a file.
I *think* you'll have to redirect it out. Obviously you could redirect it to a log file on the shared updates server, perhaps qualified by the server name ("orcl") or some other unique identifier. TJG _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32