Code:
function Escape(v) if (v == nil) then return ""; end if (type(v) == "table") then return Table.Concat(v, ", "); end if (type(v) == "boolean") then if (v == true) then return "Yes"; else return "No"; end end return v; end function get_computerID() local objWMIService = luacom.GetObject("winmgmts:\\\\.\\root\\CIMV2"); local objColItems = objWMIService:ExecQuery("SELECT * FROM Win32_BIOS", "WQL", 48); if (objColItems) then local oEnum = luacom.GetEnumerator(objColItems); local objItem = oEnum:Next(); while (objItem) do computerid = Escape(objItem:SerialNumber()); Output = ""; objItem = oEnum:Next(); end else Dialog.Message("Error", "ID cannot be retrieved!!"); Application.Exit(); end if not computerid or computerid == "" then Dialog.Message("Error", "ID cannot be retrieved!", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1); Application.Exit(); end end
Leave a comment: