wimal Posted July 3, 2017 Share Posted July 3, 2017 (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. Quote Link to comment Share on other sites More sharing options...
rlx Posted July 3, 2017 Share Posted July 3, 2017 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 Quote Link to comment Share on other sites More sharing options...
ziele_o2k Posted July 3, 2017 Share Posted July 3, 2017 Something usefull you can also find here Quote Link to comment Share on other sites More sharing options...
wimal Posted July 4, 2017 Author Share Posted July 4, 2017 Thanks for both of you Quote Link to comment Share on other sites More sharing options...
wimal Posted July 4, 2017 Author Share Posted July 4, 2017 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) Quote Link to comment Share on other sites More sharing options...
rlx Posted July 4, 2017 Share Posted July 4, 2017 (getenv "COMPUTERNAME") ? Quote Link to comment Share on other sites More sharing options...
rlx Posted July 4, 2017 Share Posted July 4, 2017 (edited) 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 July 4, 2017 by rlx Quote Link to comment Share on other sites More sharing options...
wimal Posted July 5, 2017 Author Share Posted July 5, 2017 rix. Thanks you very much. Quote Link to comment Share on other sites More sharing options...
lido Posted January 9, 2019 Share Posted January 9, 2019 (edited) 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 January 9, 2019 by lido Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 9, 2019 Share Posted January 9, 2019 Some more Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.