Solved

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

Posted on 2004-04-13
4
557 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

751 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