Jump to content

Filete serial number


wimal

Recommended Posts

(vlax-dump-Object (vlax-invoke (vlax-create-object "Scripting.FileSystemObject") 'getdrive "c:")t)

; IDrive: Drive Interface

; Property values:

; AvailableSpace (RO) = 4.24501e+010

; DriveLetter (RO) = "C"

; DriveType (RO) = 2

; FileSystem (RO) = "NTFS"

; FreeSpace (RO) = 4.24501e+010

; IsReady (RO) = -1

; Path (RO) = "C:"

; RootFolder (RO) = #

; SerialNumber (RO) = -1797114356

; ShareName (RO) = ""

; TotalSize (RO) = 1.1479e+011

; VolumeName = ""

; No methods

 

 

 

Please help some one to absorb the serial number of disk from the list generated by the above code.

Link to comment
Share on other sites

like this?

 

 



(defun DriveSerial (drive / *error* sys serial drive)
 ;; Get specified drive's serial number
 ;; drive - string of drive in question (eg. "c:" or "c")
 (defun *error* (m)
   (mapcar
     (function (lambda (x) (vl-catch-all-apply (function vlax-release-object) (list x))))
     (list drive sys)
   )
 )
 (if (setq sys (vlax-create-object "Scripting.FileSystemObject"))
   (setq serial (vlax-get (setq drive (vlax-invoke sys 'GetDrive drive)) 'SerialNumber))
 )
 (*error* nil)
 serial
)


 

 

gr. Rlx

Link to comment
Share on other sites

like this?

 

 



(defun DriveSerial (drive / *error* sys serial drive)
 ;; Get specified drive's serial number
 ;; drive - string of drive in question (eg. "c:" or "c")
 (defun *error* (m)
   (mapcar
     (function (lambda (x) (vl-catch-all-apply (function vlax-release-object) (list x))))
     (list drive sys)
   )
 )
 (if (setq sys (vlax-create-object "Scripting.FileSystemObject"))
   (setq serial (vlax-get (setq drive (vlax-invoke sys 'GetDrive drive)) 'SerialNumber))
 )
 (*error* nil)
 serial
)


 

 

gr. Rlx

 

Can I get the Product ID of the PC in this way? (I mean Some identification number of the PC)

Link to comment
Share on other sites

or even :

 

 



; [url]http://forums.augi.com/showthread.php?4391-Retrieve-Computer-ID[/url]
(cond ((setq wscript (vlax-create-object "WScript.Network"))
      (setq pcname (vlax-get-property wscript "ComputerName")
            pcdom  (vlax-get-property wscript "UserDomain")
            pcuser (vlax-get-property wscript "UserName")
      )
      (mapcar 'princ
              (list "\nComputername: "  pcname
                    "\nUser domain:  "  pcdom
                    "\nUser name:    "  pcuser
                   )
      )
      (vlax-release-object wscript)
     )
)


(by the way , same info as link from ziele_o2k in post #3 haha)

 

 

and if you even want to go deeper

 

 


; [url]https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bios-serial-number/td-p/3779931[/url]
(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)
)


gr. Rlx

Edited by rlx
Link to comment
Share on other sites

  • 1 year later...

Only for Bios:

(DEFUN C:BiosInfo (/ construct)
	(setq name_lst nil value_lst nil)
	(defun construct (val)
		(vlax-for
			it
			val
			(setq name_lst		(cons (vlax-get it (quote name))  name_lst)
					value_lst	(cons (vlax-get it (quote value)) value_lst)
			)
		)
	)
	(vlax-for
		item
		(vlax-invoke
			(vlax-invoke
				(vlax-create-object "WbemScripting.SWbemLocator")
				(quote ConnectServer)
				nil
				nil
				nil
				nil
				nil
				nil
				nil
				nil
			)
			(quote ExecQuery)
			"Select BiosCharacteristics from Win32_BIOS"
		)
		(construct (vlax-get item (quote Properties_)))
		(construct (vlax-get item (quote Qualifiers_)))
	)
)

 

Edited by lido
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...