• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    Distinguished Contributor
    Posts: 147
    Registered: ‎11-05-2008
    Accepted Solution

    BIOS serial number

    163 Views, 3 Replies
    02-13-2013 12:16 PM

    Hi,

     

    I know that in the MS Windows' "command prompt windows" I can type:

     

    WMIC BIOS GET SERIALNUMBER

     


    to get BIOS serial number. so how can I get it with LISP?

     

    Thanks,

     

    Please use plain text.
    Distinguished Contributor
    Posts: 147
    Registered: ‎11-05-2008

    Re: BIOS serial number

    02-13-2013 02:04 PM in reply to: aqdam1978

    Hi

     

    I also find another way via VBS

     

    make a text file and rename it to 1.vbs

    paste below code and save and double click on icon:

     

    On Error Resume Next
    Dim strComputer
    strComputer = InputBox("Enter the name of the computer:")
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
    For Each objSMBIOS in colSMBIOS
    MsgBox strComputer & ": " & objSMBIOS.SerialNumber
    Next

     

    Please use plain text.
    Distinguished Contributor
    Posts: 147
    Registered: ‎11-05-2008

    Re: BIOS serial number

    02-13-2013 06:46 PM in reply to: aqdam1978

    Hi

     

    here a lisp program that extract all system information:

    (defun c:SystemInfo(/ item meth1 meth2 process wmi)
    	(defun lister(val / it)
    		(vlax-for it val
    			(princ (strcat "\n" (vlax-get it 'name) " : "))
    			(if (vlax-get it 'value) (princ (vlax-get it 'value)) (princ "Nil"))
    		)
    	)
    
    (vl-load-com)
    (setq WMI (vlax-create-object "WbemScripting.SWbemLocator"))
    (setq meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil))
    
    (foreach process (list "BIOS" "Processor" "VideoController" "SoundDevice" "CDROMDrive" "OperatingSystem" "ComputerSystem" "PhysicalMemory" "DiskDrive")
    	(setq meth2 (vlax-invoke meth1 'ExecQuery (strcat "Select * from Win32_" Process)))
    	(princ (strcat "\nfeatures of " process " :"))
    	(vlax-for item meth2
    		(lister (vlax-get item 'Properties_))
    		(lister (vlax-get item 'Qualifiers_))
    		(getkword "\nPress Enter to continue...")
    	)
    );;foreach
    (mapcar 'vlax-release-object (list meth1 meth2 wmi))
    (princ)
    )

     So, does anybody can summerize it to a single function that gives me just Bios.SerialNumber as a string variable?

     

    Thanks,

     

    Please use plain text.
    *Expert Elite*
    Posts: 2,066
    Registered: ‎11-24-2009

    Re: BIOS serial number

    02-13-2013 07:24 PM in reply to: aqdam1978

    aqdam1978 wrote:

    So, does anybody can summerize it to a single function that gives me just Bios.SerialNumber as a string variable?

     

    Thanks,

     


    (defun c:SerialInfo  (/ WMI meth1 meth2 serial)
      (vl-load-com)
      (cond ((and (setq WMI (vlax-create-object "WbemScripting.SWbemLocator"))
                  (setq meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil))
                  (setq meth2 (vlax-invoke meth1 'ExecQuery (strcat "Select * from Win32_" "BIOS")))
                  (vlax-for itm  (vlax-get (vlax-invoke meth2 'ItemIndex 0) 'Properties_)
                    (if (eq (vlax-get itm 'name) "SerialNumber")
                      (setq serial (vlax-get itm 'value)))))))
      (mapcar 'vlax-release-object (list meth1 meth2 wmi))
      serial)

     

    HTH

    Please use plain text.