Using the microsoft sample code located at
http://www.microsoft.com/technet/scriptcenter/scripts/python/ad/domains/addmpy01.mspx,
I find that the code will not run if the the scripting
library (Microsoft WMI Scripting V1.2 Library) is
configured for early binding (that is, I use the makepy
utility). If I remove the early binding, the script
runs fine.
With early binding enabled, I get the following output:
--- begin output ---
Caption:
Traceback (most recent call last):
File "C:\bin\domain_enum.py", line 7, in ?
print "Caption: ", objItem.Caption
File "C:\Program
Files\Python\Lib\site-packages\win32com\client\__init__.py",
line 454, in __getattr__
raise AttributeError, "'%s' object has no attribute
'%s'" % (repr(self), attr)
AttributeError: '<win32com.gen_py.Microsoft WMI
Scripting V1.2 Library.ISWbemObjectEx instance at
0x14848208>' object has no attribute 'Caption'
--- end output ---
I have found that the objItem.Caption attribute is not
available, but I can use objItem.Properties_.Item(
'Caption' ).Value to acquire the correct result.
I am unsure how to approach this problem, but I post it
for public knowledge. I will be happy to look into the
problem further or provide more information, but I
would need some direction to proceed.
Logged In: YES
user_id=14198
It looks like these interfaces are designed to be used
early-bound. I can't find 'Caption' described in the
typelib at all. I'm not sure how to proceed either!
Logged In: YES
user_id=360594
Originator: NO
I get the same error when I try to create an SMS_CollectionMembershipRule object using WMI.