Maybe (virtual serial):
(defun HDSerial ( drive / fso drv ser )
(vl-catch-all-apply
(function
(lambda nil
(setq fso (vlax-create-object "Scripting.FileSystemObject")
drv (vlax-invoke-method fso 'getdrive drive)
ser (vlax-get-property drv 'serialnumber)
)
)
)
)
(if drv (vlax-release-object drv))
(if fso (vlax-release-object fso))
ser
)
Or, for the manufacturer's Serial number (only works in Vista or 7):
(defun HDSerial ( / wmi srv drv ser )
(vl-catch-all-apply
(function
(lambda ( )
(if
(setq wmi (vlax-create-object "WbemScripting.SWbemLocator")
srv (vlax-invoke wmi 'connectserver nil nil nil nil nil nil nil nil)
drv (vlax-invoke srv 'execquery "Select SerialNumber from Win32_DiskDrive")
)
(vlax-for item drv
(vlax-for prop (vlax-get item 'Properties_)
(if (eq "SERIALNUMBER" (strcase (vlax-get prop 'name)))
(setq ser (vl-string-trim " " (vlax-get prop 'value)))
)
)
)
)
)
)
)
(if drv (vlax-release-object drv))
(if srv (vlax-release-object srv))
(if wmi (vlax-release-object wmi))
ser
)