Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BIOS serial number

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
aqdam1978
2256 Views, 3 Replies

BIOS serial number

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,

 

3 REPLIES 3
Message 2 of 4
aqdam1978
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

 

Message 3 of 4
aqdam1978
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,

 

Message 4 of 4
pbejse
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost