[python-win32] AddMembershipRule(SMS_CollectionRuleDirect): Generic failure

John Randolph johnrandolph at gmail.com
Fri Apr 17 22:59:51 CEST 2009


Hi list:

I've been beating my head against this problem for 2 days and can't
figure it out.  Searching the archives produced a semi-relevant thread
from the past but the former fixes haven't worked for me.

Using wmi 1.3.2, I've got the following simple code:

    system = wmih.SMS_R_System(NetbiosName=hostname)
    new_rule = wmih.SMS_CollectionRuleDirect.new()
    new_rule.ResourceID = system[0].ResourceID
    new_rule.RuleName = '%s (%d)' % (hostname, system[0].ResourceID)
    new_rule.ResourceClassName = 'SMS_R_System'
    query_id, rv = c.AddMembershipRule(new_rule)

I've also tried getting the method InParameters, populating them and
calling the method directly as previous list traffic experimented
with.

However, neither method allows me to add the rule.   The code above
produces the following exception:

  File "remotewmi.py", line 115, in PolicyInstall
    query_id, rv = c.AddMembershipRule(new_rule)
  File "C:\Documents and Settings\jrand\wmi.py", line 396, in __call__
    handle_com_error (error_info)
  File "C:\Documents and Settings\jrand\wmi.py", line 189, in handle_com_error
    raise x_wmi, "\n".join (exception_string)
wmi.x_wmi: -0x7ffdfff7 - Exception occurred.
  Error in: SWbemObjectEx
  -0x7ffbefff - Generic failure


More information about the python-win32 mailing list