Solved

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

Posted on 2004-04-13
4
545 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now