Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.6 KiB

  1. ' Get a disk
  2. set disk = GetObject ("winmgmts:win32_logicaldisk='C:'")
  3. wbemCimtypeSint8 = 16
  4. wbemCimtypeUint8 = 17
  5. wbemCimtypeSint16 = 2
  6. wbemCimtypeUint16 = 18
  7. wbemCimtypeSint32 = 3
  8. wbemCimtypeUint32 = 19
  9. wbemCimtypeSint64 = 20
  10. wbemCimtypeUint64 = 21
  11. wbemCimtypeReal32 = 4
  12. wbemCimtypeReal64 = 5
  13. wbemCimtypeBoolean = 11
  14. wbemCimtypeString = 8
  15. wbemCimtypeDatetime = 101
  16. wbemCimtypeReference = 102
  17. wbemCimtypeChar16 = 103
  18. wbemCimtypeObject = 13
  19. wbemCimtypeIUnknown = 104
  20. GetAs "wbemCimtypeBoolean", wbemCimtypeBoolean
  21. GetAs "wbemCimtypeUint8", wbemCimtypeUint8
  22. GetAs "wbemCimtypeSint8", wbemCimtypeSint8
  23. GetAs "wbemCimtypeUint16", wbemCimtypeUint16
  24. GetAs "wbemCimtypeSint16", wbemCimtypeSint16
  25. GetAs "wbemCimtypeUint32", wbemCimtypeUint32
  26. GetAs "wbemCimtypeSint32", wbemCimtypeSint32
  27. GetAs "wbemCimtypeUint64", wbemCimtypeUint64
  28. GetAs "wbemCimtypeSint64", wbemCimtypeSint64
  29. GetAs "wbemCimtypeReal32", wbemCimtypeReal32
  30. GetAs "wbemCimtypeReal64", wbemCimtypeReal64
  31. GetAs "wbemCimtypeChar16", wbemCimtypeChar16
  32. GetAs "wbemCimtypeString", wbemCimtypeString
  33. GetAs "wbemCimtypeDatetime", wbemCimtypeDatetime
  34. GetAs "wbemCimtypeReference", wbemCimtypeReference
  35. GetAs "wbemCimtypeObject", wbemCimtypeObject
  36. GetAs "wbemCimtypeIUnknown", wbemCimtypeIUnknown
  37. Public sub GetAs (ByVal cimStr, ByVal cimtype)
  38. on error resume next
  39. WScript.Echo
  40. WScript.Echo cimStr
  41. WScript.Echo "================="
  42. freeSpace = disk.Properties_("FreeSpace").GetAs (cimtype)
  43. if Err <> 0 then
  44. WScript.Echo "Error:", "0x" & Hex(Err.Number), Err.Description, Err.Source
  45. else
  46. WScript.Echo "Value:" , freespace
  47. end if
  48. end sub