Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 573
  • Last Modified:

Need Help:delphi access WMI --how to modify the property

I'm use delphi 7.0 + WbemScripting_TLB.pas access WMI.
      I can read the property's value, but unknown howto modify proerty's
value.
      how to use SWBemObject.Put_ method??
      need your help, thank's.

     attach my code.
----------------------------------------------------------------------------
//......
      Locator := CoSWbemLocator.Create;
//.....
      Services :=  Locator.ConnectServer('', 'root\......
//.....
      wmiObject := IUnknown(TempObj) as SWBemObject;
      propSet   := wmiObject.Properties_;
      propEnum := (propSet._NewEnum) as IEnumVariant;
      Set_v := 'XX'+'...';
      //get property list
      while (propEnum.Next(1, TempObj, Value) = S_OK) do begin
        wmiProp  := IUnknown(TempObj) as SWBemProperty;

          case wmiProp.CIMType of
          wbemCimtypeString:
          begin
            //select value into Temp_S, success.
            Temp_S := Temp_S+wmiProp.Name+':'+wmiProp.Get_Value()+#13#10;
            wmiProp.Set_Value(Set_v);

//=============
            wmiObject.Put_(0,null); //Error! ---need help how to use SWBemObject.Put_??

//=============
          end;
        end
//......
----------------------------------------------------------------------------
0
biniyi
Asked:
biniyi
1 Solution
 
Melih SARICACommented:
Did u use the value property for ur variable wmiProp

i mean
..
wmiProp.value := 0;
....

WbemProperty has a property called value and its both used for getting and setting value..




0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now