Solved

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

Posted on 2004-04-13
4
555 Views
Last Modified: 2010-04-04
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
Comment
Question by:biniyi
4 Comments
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 50 total points
ID: 10850237
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Printing problem 2 102
can't find the executable in Simulator 1 101
PHP preg_replace code convert to Delphi 14 68
How to Get Images From Server using App Tethering 11 40
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question