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.

115 lines
2.7 KiB

  1. @echo off
  2. set FormatVolume=0
  3. if "%1" == "" goto Usage
  4. if "%1" == "help" goto Usage
  5. if "%1" == "-?" goto Usage
  6. if "%1" == "/?" goto Usage
  7. if "%1" == "-help" goto Usage
  8. if "%1" == "/help" goto Usage
  9. if "%1" == "-f" set FormatVolume=1
  10. setlocal
  11. set DriveLetter=%1
  12. set VolumePath=%1\
  13. set QueryVolumePath='%VolumePath%\'
  14. wmic volume where name=%QueryVolumePath% get name,filesystem,capacity,freespace,dirtybitset
  15. if errorlevel 1 (
  16. echo volume not found
  17. goto :eof
  18. )
  19. @rem --- AddMountPoint test ---
  20. set MountDir=%VolumePath%wmicVolumeTestDirectory\
  21. set MungedMountDir=%VolumePath%\wmicVolumeTestDirectory
  22. rd %MountDir%
  23. md %MountDir%
  24. echo ====
  25. echo ==== calling addmountpoint(%MountDir%) method
  26. echo ====
  27. wmic volume where name=%QueryVolumePath% call addmountpoint %MountDir%
  28. echo ====
  29. echo ==== verifying mountpoint
  30. echo ====
  31. wmic path win32_mountpoint where directory="win32_directory.name='%MungedMountDir%'"
  32. echo ====
  33. echo ==== deleting mountpoint
  34. echo ====
  35. wmic path win32_mountpoint where directory="win32_directory.name='%MungedMountDir%'" delete
  36. echo ====
  37. echo ==== verifying mountpoint delete
  38. echo ====
  39. wmic path win32_mountpoint where directory="win32_directory.name='%MungedMountDir%'"
  40. rd %MountDir%
  41. @rem --- Chkdsk test ---
  42. echo ====
  43. echo ==== marking %DriveLetter% dirty
  44. echo ====
  45. fsutil dirty set %driveLetter%
  46. fsutil dirty query %driveLetter%
  47. wmic volume where name=%QueryVolumePath% get name,dirtybitset
  48. echo ====
  49. echo ==== running Chkdsk - forced
  50. echo ====
  51. wmic volume where name=%QueryVolumePath% call chkdsk False,True,False,False,True,False
  52. echo ====
  53. echo ==== verify dirty bit cleared
  54. echo ====
  55. fsutil dirty query %driveLetter%
  56. wmic volume where name=%QueryVolumePath% get name,dirtybitset
  57. @rem --- DefragAnalysis test ---
  58. echo ====
  59. echo ==== copying and fraging files
  60. echo ====
  61. xcopy /q %windir%\system32\wbem\*.* %VolumePath%
  62. \\guhans-dev\public\tools\frag.exe -r -f20 %VolumePath%
  63. echo ====
  64. echo ==== running DefragAnalysis
  65. echo ====
  66. wmic volume where name=%QueryVolumePath% call defraganalysis
  67. @rem --- Defrag test ---
  68. echo ====
  69. echo ==== running Defrag
  70. echo ====
  71. wmic volume where name=%QueryVolumePath% call defrag
  72. @rem --- ScheduleAutoChk test ---
  73. echo ====
  74. echo ==== running ScheduleAutoChk
  75. echo ====
  76. wmic volume call scheduleAutoChk (%VolumePath%)
  77. chkntfs %DriveLetter%
  78. @rem --- ScheduleAutoChk test ---
  79. echo ====
  80. echo ==== running ExcludeFromAutoChk
  81. echo ====
  82. wmic volume call excludeFromAutoChk (%VolumePath%)
  83. chkntfs %DriveLetter%
  84. @rem TODO: volume methods: format, mount, dismount
  85. echo ---- List All Volumes ----
  86. wmic volume list brief
  87. wmic volume list status
  88. wmic volume list full
  89. endlocal
  90. goto :eof
  91. :Usage
  92. echo wmicvolume driveLetter: