biniyi
asked on
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+':'+wm iProp.Get_ Value()+#1 3#10;
wmiProp.Set_Value(Set_v);
//=============
wmiObject.Put_(0,null); //Error! ---need help how to use SWBemObject.Put_??
//=============
end;
end
//......
-------------------------- ---------- ---------- ---------- ---------- ----------
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+':'+wm
wmiProp.Set_Value(Set_v);
//=============
wmiObject.Put_(0,null); //Error! ---need help how to use SWBemObject.Put_??
//=============
end;
end
//......
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.