


Your code is not working because you are passing a double-quote in the WMI class name.Ĭhange this code GetWMIstring('','Win32_DiskDrive"','SerialNumber')

* so please can any one correct my Code or Give me another idea Y:=GetWMIstring('','Win32_DiskDrive"','SerialNumber') X:=GetWMIstring('','Win32_BIOS','SerialNumber') Procedure TForm4.Button1Click(Sender: TObject) SProp := SObject.Properties_.Item(wmiProperty, 0) Įxcept // Trap any exceptions (Not having WMI installed will cause one!) SObject := IUnknown(tempObj) as ISWBemObject While (Enum.Next(1, TempObj, Value) = S_OK) do WbemFlagReturnImmediately and wbemFlagForwardOnly, nil) Įnum := (ObjSet._NewEnum) as IEnumVariant ObjSet := Services.ExecQuery('SELECT * FROM '+wmiClass, 'WQL', Services := Locator.ConnectServer(wmiHost, 'root\cimv2', '', '', '','', 0, nil) Connect to the WMI service, with the root\cimv2 namespace Locator := CoSWbemLocator.Create // Create the Location object Var // These are all needed for the WMI querying process Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,ĭialogs, StdCtrls,WbemScripting_TLB,ActiveX įunction GetWMIstring (wmiHost, wmiClass, wmiProperty : string):string So my choose now is HDD Real serial number i am try this code below to get it but it didn'r work unit Unit2 I am trying to make delphi program Server And Client so To Secure my App and To Make Sure all user are under control i should give them a unique Key that can't be change to not lose them Handle, So i think it should be HDD Serial Number + Bios SN, but i remember that Bios Can Be Change When remove motherboard Battery so it will not be work.
