我们目前使用WmiSet
Online Admin在远程计算机上运行 Wmi 查询和查询注册表设置。
问题是它只支持到 RAD Studio 2007 的 Delphi。
我们目前正在升级到 Delphi XE,需要知道是否有人知道或拥有更新版本的WmiSet
组件或类似的东西。
我们已尝试联系供应商,但到目前为止,我们的任何查询都没有得到任何答复。
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.
将 WMISet 库转换为 Unicode Delphi 并不太难。我已经完成了到 Delphi 2009 和 2010 的转换,编译器将您指向那些需要更改的代码行。如果我找到时间,我将为 UniCode Delphi 准备原始代码和更改后的代码之间的“差异”并上传。
问候, 奥拉夫