none
Troubles with ModifyResourceSettings RRS feed

  • Question

  • Hello. Help me please. I try to change settings in Hyper-v VM

    Here is my code on Python

    ====================================================

    import wmi

    con_wmi = wmi.WMI(moniker='root/virtualization/v2')
    vmSystem = con_wmi.Msvm_ComputerSystem(ElementName='Etalon_W7')

    vmsettings = vmSystem[0].associators(wmi_result_class='Msvm_VirtualSystemSettingData')
    mem_settings = vmsettings[0].associators(wmi_result_class='Msvm_MemorySettingData')[0]

    vs_man_svc = con_wmi.Msvm_VirtualSystemManagementService()[0]
    (job_path,vm_path) = vs_man_svc.ModifyResourceSettings(ResourceSettings = mem_settings.GetText_(1))


    #(job_path,vm_path) = vs_man_svc.ModifySystemSettings(vmsettings[0].GetText_(1))

    ==========================

    ModifySystemSettings work correctly, but ModifyResourceSettings return error

    Traceback (most recent call last):
      File "C:/Users/������/Desktop/������ �� ������/Program/test.py", line 10, in <module>
        (job_path,vm_path) = vs_man_svc.ModifyResourceSettings(ResourceSettings = mem_settings.GetText_(1))
      File "C:\Python27\lib\site-packages\wmi.py", line 431, in __call__
        handle_com_error ()
      File "C:\Python27\lib\site-packages\wmi.py", line 241, in handle_com_error
        raise klass (com_error=err)
    wmi.x_wmi: <x_wmi: Unexpected COM Error (-2147352567, '\xce\xf8\xe8\xe1\xea\xe0.', (0, u'SWbemProperty', u'\u041d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0438\u043f\u0430 ', None, 0, -2147217403), None)>

    Tuesday, June 16, 2015 10:00 AM