home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 November / PCWorld_2005-11_cd.bin / software / topware / samurize / samurize_1.63.exe / Scripts / ExtendedDrive.vbs < prev    next >
Text File  |  2003-03-19  |  4KB  |  142 lines

  1. 'Extended Drive Attributes VBScript
  2. 'Version 1.5
  3. 'Created 4th June 2002
  4. 'Last Modified 19th March 2003
  5. 'Copyright 2003, Rowan Gillson
  6. 'Not redistributable without express permission from author.
  7. 'Suitable for Windows 2000/Windows XP only.
  8. '
  9. '
  10. 'comments to r_gillson@hotmail.com
  11. '
  12.  
  13. On Error Resume Next
  14.  
  15. Dim oFileSys, Drive, sDriveType, ComputerName, DriveIndex
  16.  
  17. '----------------------------------------------
  18. 'WMI Class Enumerator
  19. '----------------------------------------------
  20. Private Sub GetWMI(ComputerName, WMIArray, WMIQuery, WMIExtension)
  21.  
  22. Set WMIClass = GetObject("winmgmts:" _
  23.     & "{impersonationLevel=impersonate}!\\" & ComputerName & "\root\cimv2")
  24. Set WMIArray = WMIClass.ExecQuery(WMIQuery & WMIExtension)
  25.  
  26. End Sub
  27.  
  28. '----------------------------------------------
  29.  
  30. '----------------------------------------------
  31. 'Displays fixed disk model
  32. Function DriveName(ComputerName, DriveIndex)
  33.  
  34. Call GetWMI(ComputerName, DiskInfoSet, "Select * from Win32_DiskDrive where Index = ", DriveIndex)
  35.  
  36. For Each objDiskInfo in DiskInfoSet
  37.     DriveName = objDiskInfo.Model
  38. Next
  39.  
  40. End Function
  41.  
  42. '----------------------------------------------
  43. 'Displays SCSI Bus ID
  44. Function SCSIBusID(ComputerName, DriveIndex)
  45.  
  46. Call GetWMI(ComputerName, DiskInfoSet, "Select * from Win32_DiskDrive where Index = ", DriveIndex)
  47.  
  48. For Each objDiskInfo in DiskInfoSet
  49.     SCSIBusID = objDiskInfo.SCSIBus
  50. Next
  51.  
  52. End Function
  53.  
  54. '----------------------------------------------
  55. 'Displays SCSI Logical Unit Number (LUN)
  56. Function SCSILunID(ComputerName, DriveIndex)
  57.  
  58. Call GetWMI(ComputerName, DiskInfoSet, "Select * from Win32_DiskDrive where Index = ", DriveIndex)
  59.  
  60. For Each objDiskInfo in DiskInfoSet
  61.     SCSILunID = objDiskInfo.SCSILogicalUnit
  62. Next
  63.  
  64. End Function
  65.  
  66. '----------------------------------------------
  67. 'Displays SCSI Port Number
  68. Function SCSIPortID(ComputerName, DriveIndex)
  69.  
  70. Call GetWMI(ComputerName, DiskInfoSet, "Select * from Win32_DiskDrive where Index = ", DriveIndex)
  71.  
  72. For Each objDiskInfo in DiskInfoSet
  73.     SCSIPortID = objDiskInfo.SCSILogicalUnit
  74. Next
  75.  
  76. End Function
  77.  
  78. '----------------------------------------------
  79. 'Displays SCSI Target Id
  80. Function SCSITargetID(ComputerName, DriveIndex)
  81.  
  82. Call GetWMI(ComputerName, DiskInfoSet, "Select * from Win32_DiskDrive where Index = ", DriveIndex)
  83.  
  84. For each objDiskInfo in DiskInfoSet
  85.     SCSITargetID = objDiskInfo.SCSITargetId
  86. Next
  87.  
  88. End Function
  89.  
  90. '----------------------------------------------
  91.  
  92.  
  93. '----------------------------------------------
  94. 'Displays individual drive volume name
  95. Function VolumeName(DriveLetter)
  96.  
  97. Set oFileSys = CreateObject("Scripting.FileSystemObject")
  98. Set Drive = oFileSys.GetDrive(Driveletter)
  99.  
  100. If Drive.IsReady = True Then
  101.     VolumeName = Drive.VolumeName
  102. Else
  103.     VolumeName = "Not Ready"
  104. End If
  105.  
  106. End Function
  107.  
  108. '----------------------------------------------
  109. 'Displays individual volume type
  110. Function DriveType(DriveLetter)
  111.  
  112. Set oFileSys = CreateObject("Scripting.FileSystemObject")
  113. Set Drive = oFileSys.GetDrive(Driveletter)
  114.  
  115. Select Case Drive.DriveType
  116.     Case 0: sDriveType = "Unknown"
  117.     Case 1: sDriveType = "Removable"
  118.     Case 2: sDriveType = "Fixed"
  119.     Case 3: sDriveType = "Network"
  120.     Case 4: sDriveType = "CD-ROM"
  121.     Case 5: sDriveType = "RAM Disk"
  122. End Select
  123.     DriveType = sDriveType
  124.  
  125. End Function
  126.  
  127. '----------------------------------------------
  128. 'Displays individual partition filesystem type
  129. Function FileSysType(DriveLetter)
  130.  
  131. Set oFileSys = CreateObject("Scripting.FileSystemObject")
  132. Set Drive = oFileSys.GetDrive(Driveletter)
  133.  
  134. If Drive.IsReady = True Then
  135.     FileSysType = Drive.FileSystem
  136. Else
  137.     FileSysType = "Not Ready"
  138. End If
  139.  
  140. End Function
  141.  
  142.