I just tried to retrieve the serial number from the HD .. it returned nil ... did I miss something?
; -- Function VxGetDriveInfos
; Returns information's from a drive.
; Copyright:
; ©2001 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
; Drv = Drive character, e.g. "C" or "C:" [STR]
; Return [Type]:
; > Drive infos '(TotalSize FreeSpace DriveType FileSystem SerialNumber
; ShareName VolumeName)
; Explanations:
; - TotalSize (kB)
[REAL]
; Returns the total space of a drive or network share.
; - FreeSpace (kB) [REAL]
; Returns the amount of space available to a user on the specified drive
; or network share.
; - DriveType [INT]
; 0 = "Unknown"
; 1 = "Removable"
; 2 = "Fixed"
; 3 = "Network"
; 4 = "CD-ROM"
; 5 = "RAM Disk"
; - FileSystem [STR]
; Returns the type of file system in use for the specified drive, e.g.
; "FAT", "NTFS", "CDFS".
; - SerialNumber [INT]
; Returns the serial number used to uniquely identify a disk volume.
; - ShareName [STR]
; Returns the network share name (UNC) for the specified drive. If it's
; not a network drive, ShareName returns a zero-length string ("").
; - VolumeName [STR]
; Returns the volume name of the specified drive.
; > 0 The drive doesn't exist.
; > -1 The drive is not ready. For removable-media drives and CD-ROM drives,
; VxGetDriveInfos returns -1 when the appropriate media is not inserted
; or not ready for access.
; Notes:
; - Requires ScrRun.dll (see also notes at top of page).
;
(defun VxGetDriveInfos (Drv / DrvObj FilSys RetVal)
(vl-load-com)
(setq FilSys (vlax-create-object "Scripting.FileSystemObject")
RetVal (cond
((= (vlax-invoke FilSys 'DriveExists Drv) 0) 0)
((setq DrvObj (vlax-invoke FilSys 'GetDrive Drv))
(cond
((= (vlax-get DrvObj 'IsReady) 0) -1)
((list
(/ (vlax-get DrvObj 'TotalSize) 1000.0)
(/ (vlax-get DrvObj 'FreeSpace) 1000.0)
(vlax-get DrvObj 'DriveType)
(vlax-get DrvObj 'FileSystem)
(vlax-get DrvObj 'SerialNumber)
(vlax-get DrvObj 'ShareName)
(vlax-get DrvObj 'VolumeName)
)
)
)
)
)
)
(if DrvObj (vlax-release-object DrvObj))
(vlax-release-object FilSys)
RetVal
)