Thierry Lam wrote: > I'm using the WMI library for python and I was able to connect to > another computer on the network with the following line: > > c = wmi.WMI(computer="the-network-computer", user="hello", > password="hello") > > Is there a way to write information to a file on that computer? > > How do I read environment variables, for example SystemDrive?
Questions of this sort are really Win32 questions rather than Python questions. That's not to say we can't help, but rather that you can probably find an answer by going to a search engine of your choice and typing in, say, "WMI SystemDrive". I did that, and the first hit (from Google) was: http://msdn2.microsoft.com/en-us/library/aa394239.aspx which indicates that it's available from the Win32_OperatingSystem WMI class. So, in Python: <code> import wmi c = wmi.WMI () # optionally on another computer for os in c.Win32_OperatingSystem (): print os # show the whole thing print os.SystemDrive # get only what you want </code> If you were after Environment Variables, then search again, this time for "WMI Environment Variables". Third hit: http://msdn2.microsoft.com/en-us/library/aa394143.aspx pointing to the Win32_Environment class. And so on. Your first question: can I write into a file? is a little more tricky. As far as I know, there's no way even to *create* a file with WMI, let alone write information into it. It's not really a file-manipulation technology. You can get hold of the name of a remote file and other of its properties via the CIM_DataFile class, but you'd have to translate that into an accessible UNC to be able to access it. TJG -- http://mail.python.org/mailman/listinfo/python-list