I'm currently writing a script to access approximately 400 computers for removing a particular app from the system. I'm having problems getting results using the wmi c.CIM_DataFile (name=file). When I use file as a variable which equals to the path to the app I want to remove I don't get nothing back, however, if I hard code the path, I get results. See snippet below for an example of what I'm talking about. I appreciate in advance for any help I can get. Thank you.
import wmi import re def queryFile(file, host): print '[Debug nukeXmas()]:' + file c = wmi.WMI(host) for f in c.CIM_DataFile (name=file): print 'Install Date:', f.InstallDate def queryFile2(file, host): print '[Debug nukeXmas()]:' + file c = wmi.WMI(host) for f in c.CIM_DataFile (name="C:\\DOCUME~1\\profileName\\LOCALS~1\\Temp\\Temporary Directory 1 for deluxetreee (2).zip\\Christmas.exe"): print 'Install Date:', f.InstallDate #File to query string = "C:\DOCUME~1\profileName\LOCALS~1\Temp\\Temporary Directory 1 for deluxetreee (2).zip\Christmas.exe" #Substitute "\" to "\\" path = re.sub('\\\\', '\\\\\\\\', string) #Close query path with double quotes file = '"'+path+'"' #I'm having problems here, query brings back nothing queryFile(file, '172.27.1.5') #Here, I hard code the path to the exe and it works queryFile2(file, '172.27.1.5') Kelvin Lomboy Security+, OSCP, CEH Information Security Specialist R-G Financial Corporation Phone: (787) 288-1800 x3161 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ This communication and any attachments included herein contain information that belongs to R-G FINANCIAL CORP., and/or its subsidiaries that may be confidential and/or legally privileged. The information is intended only for the use of the individual or entity named above. If you have received this communication by error please delete or destroy it and notify the sender immediately. Its unauthorized disclosure, copying or distribution is strictly prohibited.
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32