【问题标题】:Is there a replacement or update for WmiSet for post-Delphi 2007?Delphi 2007 后的 WmiSet 是否有替代或更新?
【发布时间】:2011-07-07 11:00:21
【问题描述】:

我们目前使用Online Admin 中的WmiSet 在远程计算机上运行 Wmi 查询和查询注册表设置。

问题是它只支持到 RAD Studio 2007 的 Delphi。

我们目前正在升级到 Delphi XE,需要知道是否有人知道或拥有更新版本的 WmiSet 组件或类似的东西。

我们已尝试联系供应商,但到目前为止,我们的任何疑问都没有得到任何答复。

【问题讨论】:

    标签: delphi wmi wmi-query


    【解决方案1】:

    Pieter,前段时间我启动了一个名为Delphi Wmi Class Generator 的项目,该项目创建了完整文档化的 Object Pascal 类(与 delphi 7 到 XE 兼容)来访问 WMI。

    检查这段代码,它使用TWin32_BIOS 类(由应用程序创建)来访问 Win32_BIOS 远程机器中的 wmi 类。

    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.
    

    【讨论】:

    • 谢谢。我们一定会看的!
    • 抱歉更改了我的答案,但 Olaf 让我们可以使用 Delphi XE 中的当前组件,因此我们不必基于它修改现有代码。问候。
    【解决方案2】:

    将 WMISet 库转换为 Unicode Delphi 并不难。我已经完成了到 Delphi 2009 和 2010 的转换,编译器将您指向那些需要更改的代码行。如果我有时间,我会在原始代码和更改后的代码之间为 UniCode Delphi 准备一个“差异”并上传。

    问候, 奥拉夫

    【讨论】:

    • 奥拉夫。那将是最有帮助的。谢谢。
    • 我终于有时间创建 DIFF 文件并将它们上传到 Torry.net:link。请在部署到生产环境之前进行彻底测试。
    • 奥拉夫。非常感谢您提供差异文件。一切正常,我们现在将 WMISet 安装到 Delphi XE 中。问候。
    猜你喜欢
    • 2011-09-16
    • 2011-12-26
    • 1970-01-01
    • 1970-01-01
    • 2016-01-04
    • 2018-09-19
    • 1970-01-01
    • 2012-08-27
    • 1970-01-01
    相关资源
    最近更新 更多