hardware and software inventory lazarus / 67-Windows ---------------------------------------------------------------------- anv · 2017-03-10 12:47 I am trying to create an application that grabs information about the installed hardware and software of the PCs at my work. The idea is to run on every PC an application that grabs the relevant info and automatically uploads it to a database. The main target is to detect the use of unliscensed software. Searching info in the forum I managed to create a 32 bits program that reads the data from the windows registry in 32 and 64 bits windows ad builds a table of installed apps. I think I will do a simple search on the disk to find something else. My questions are: 1) a way to get an unique identifier of the PC. May be the ethernet mac address, the windows serial number or something like this. 2) a way to get the system name and/or the ip address I can obtain some of this data RunCommand('ipconfig.exe',['/all'],s); but I prefer a cleaner way that does not open a windows for this. 3) a wey to get information about processor, ram and disk (total and free) 4) a way to run the program silently once a day (without opening a window if possible). I think this program may be userfull for other people and if you want it ask me and I will upload it to github. ---------------------------------------------------------------------- ASerge · 2017-03-12 18:23 Use WMI. Often administrators use scripts for example in powershell. But if you want the FPC, this may help: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$APPTYPE CONSOLE}program Project1; uses Windows, SysUtils, Variants, ComObj, ActiveX; function GetDynaNameProperty(const Source: Variant;  const PropertyName: AnsiString): Variant;var  Desc: TCallDesc;begin  ZeroMemory(@Desc, SizeOf(Desc));  Desc.CallType := DISPATCH_PROPERTYGET;  Move(PropertyName[1], Desc.ArgTypes[0], Length(PropertyName));  VarDispProc(@Result, Source, @Desc, nil);end; procedure WriteWMIQuery(const FWMIService: OleVariant;  const Query: WideString; const PropNames: array of string);const  WBEM_FLAG_FORWARD_ONLY = $20;  WBEM_RETURN_IMMEDIATELY = $10;var  FWbemCollection: OleVariant;  Enum: IEnumvariant;  iValue: ULONG;  FWbemObject: OleVariant;  i, k: Integer;  Prop: Variant;begin  Writeln('[', Query, ']');  FWbemCollection := FWMIService.ExecQuery(Query, 'WQL',    WBEM_FLAG_FORWARD_ONLY or WBEM_RETURN_IMMEDIATELY);  Enum := IUnknown(FWbemCollection._NewEnum) as IEnumVariant;  while Enum.Next(1, FWbemObject, iValue) = 0 do  begin    for i := Low(PropNames) to High(PropNames) do    begin      Prop := GetDynaNameProperty(FWbemObject, PropNames[i]);      if VarIsArray(Prop) then        for k := VarArrayLowBound(Prop, 1) to VarArrayHighBound(Prop, 1) do          Writeln(PropNames[i], '[', k, ']: ', Prop[k])      else        Writeln(PropNames[i], ': ', Prop);  end;    Writeln('');    FWbemObject:=Unassigned;  end;end; const  WbemUser = '';  WbemPassword = '';  WbemComputer = 'localhost';var  SWbemLocator: OleVariant;  WMIService: OleVariant;begin  NullStrictConvert := False;  SWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');  WMIService := SWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);  WriteWMIQuery(WMIService, 'select * from Win32_ComputerSystemProduct',    ['Vendor', 'Version']);  WriteWMIQuery(WMIService, 'select * from Win32_ComputerSystem',    ['Name', 'Manufacturer', 'PrimaryOwnerName', 'SystemType']);  WriteWMIQuery(WMIService, 'select * from Win32_OperatingSystem',    ['Caption', 'Version', 'OSArchitecture', 'SerialNumber', 'BootDevice', 'TotalVisibleMemorySize']);  WriteWMIQuery(WMIService, 'select * from Win32_NetworkAdapterConfiguration where IPEnabled=True',    ['Caption', 'MACAddress', 'IPAddress']);  Readln;end.