Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a replacement or update for WmiSet for post-Delphi 2007?

We currently use WmiSet from Online Admin to run Wmi Queries and query registry settings on remote machines.

The problem is that it only supports Delphi up to RAD Studio 2007.

We are currently in the process of upgrading to Delphi XE and need to know if anybody knows of — or has — a more recent version of the WmiSet components or anything similar.

We have tried to contact the vendor but so far there have not been any replies on any of our queries.

like image 444
Pieter van Wyk Avatar asked Jan 20 '23 08:01

Pieter van Wyk


2 Answers

Pieter, some time ago i start a project called Delphi Wmi Class Generator this project creates full documented Object Pascal classes (compatible with delphi 7 to XE) to access the WMI.

check this code which uses the TWin32_BIOS class (created by the application) to access the Win32_BIOS wmi class in a remote machine.

uses
  SysUtils,
  uWmiDelphiClass in '..\..\uWmiDelphiClass.pas',
  uWin32_BIOS in '..\..\root_CIMV2\uWin32_BIOS.pas';

var
  RemoteBiosInfo : TWin32_BIOS;
  i              : integer;
begin
   try
     RemoteBiosInfo:=TWin32_BIOS.Create(False);
     try

       RemoteBiosInfo.WmiServer:='192.168.217.128';
       RemoteBiosInfo.WmiUser  :='Administrator';
       RemoteBiosInfo.WmiPass  :='password'; 
       RemoteBiosInfo.LoadWmiData;

       if RemoteBiosInfo.WmiConnected then  
       begin
         Writeln('Serial Number       '+RemoteBiosInfo.SerialNumber);
         Writeln('BuildNumber         '+RemoteBiosInfo.BuildNumber);
         if RemoteBiosInfo.BIOSVersion.Count>0 then
         Writeln('Version             '+RemoteBiosInfo.BIOSVersion[0]);
         Writeln('Identification Code '+RemoteBiosInfo.IdentificationCode);
         Writeln('Manufacturer        '+RemoteBiosInfo.Manufacturer);
         Writeln('SoftwareElementID   '+RemoteBiosInfo.SoftwareElementID);
         Writeln('Release Date        '+DateToStr(RemoteBiosInfo.ReleaseDate));
         Writeln('Install Date        '+DateToStr(RemoteBiosInfo.InstallDate));
         Writeln('Target S.O          '+GetTargetOperatingSystemAsString(RemoteBiosInfo.TargetOperatingSystem));
         Writeln('Soft. element state '+GetSoftwareElementStateAsString(RemoteBiosInfo.SoftwareElementState));

         Writeln('');
         Writeln('Bios Characteristics');
         Writeln('--------------------'); 
         for i:=Low(RemoteBiosInfo.BiosCharacteristics)  to High(RemoteBiosInfo.BiosCharacteristics) do
          Writeln(GetBiosCharacteristicsAsString(RemoteBiosInfo.BiosCharacteristics[i]));
       end
       else
       Writeln('No connected');
     finally
      RemoteBiosInfo.Free;
     end;
   except
    on E:Exception do
     Writeln(E.Classname, ': ', E.Message);
   end;

 Readln;
end.
like image 59
RRUZ Avatar answered Jan 22 '23 22:01

RRUZ


converting the WMISet library to Unicode Delphi is not too difficult. I've done the conversion to Delphi 2009 and 2010, and the compiler points you towards those lines of code that need changing. If I find the time I'll prepare a "diff" between the original code and the changed one for UniCode Delphi and upload it.

Regards, Olaf

like image 39
Olaf Hess Avatar answered Jan 22 '23 21:01

Olaf Hess