Xenium
Новичок
Всем привет, наткнулся на очень интересный скрипт.
Не могу понять как выводить из него информацию, например на странице инсталлятора в поле IP address \ TotalPhysicalMemory.
Прошу помощи в выводе данной информации)
Не могу понять как выводить из него информацию, например на странице инсталлятора в поле IP address \ TotalPhysicalMemory.
Прошу помощи в выводе данной информации)
Код:
function WbemQuery(WbemServices: Variant; Query: string): Variant;
var
WbemObjectSet: Variant;
begin
Result := Null;
WbemObjectSet := WbemServices.ExecQuery(Query);
if not VarIsNull(WbemObjectSet) and (WbemObjectSet.Count > 0) then
begin
Result := WbemObjectSet.ItemIndex(0);
end;
end;
procedure CollectInformation;
var
Query: string;
WbemLocator, WbemServices: Variant;
ComputerSystem, OperatingSystem, Processor: Variant;
NetworkAdapters, NetworkAdapter: Variant;
IPAddresses: array of string;
I, I2: Integer;
begin
WbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
WbemServices := WbemLocator.ConnectServer('.', 'root\CIMV2');
Query := 'SELECT TotalPhysicalMemory, UserName FROM Win32_ComputerSystem';
ComputerSystem := WbemQuery(WbemServices, Query);
if not VarIsNull(ComputerSystem) then
begin
Log(Format('TotalPhysicalMemory=%s', [ComputerSystem.TotalPhysicalMemory]));
Log(Format('UserName=%s', [ComputerSystem.UserName]));
end;
Query := 'SELECT Caption FROM Win32_OperatingSystem';
OperatingSystem := WbemQuery(WbemServices, Query);
if not VarIsNull(OperatingSystem) then
begin
Log(Format('OperatingSystem=%s', [OperatingSystem.Caption]));
end;
Query := 'SELECT Name FROM Win32_Processor';
Processor := WbemQuery(WbemServices, Query);
if not VarIsNull(Processor) then
begin
Log(Format('Processor=%s', [Processor.Name]));
end;
Query :=
'SELECT IPEnabled, IPAddress, MACAddress ' +
'FROM Win32_NetworkAdapterConfiguration';
NetworkAdapters := WbemServices.ExecQuery(Query);
if not VarIsNull(NetworkAdapters) then
begin
for I := 0 to NetworkAdapters.Count - 1 do
begin
NetworkAdapter := NetworkAdapters.ItemIndex(I);
if (not VarIsNull(NetworkAdapter.MACAddress)) and
NetworkAdapter.IPEnabled then
begin
Log(Format('Adapter %d MAC=%s', [I, NetworkAdapter.MACAddress]));
if not VarIsNull(NetworkAdapter.IPAddress) then
begin
IPAddresses := NetworkAdapter.IPAddress;
for I2 := 0 to GetArrayLength(IPAddresses) - 1 do
begin
Log(Format('Adapter %d IP %d=%s', [I, I2, IPAddresses[I2]]));
end;
end;
end;
end;
end;
end;
Последнее редактирование модератором: