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.

78 lines
2.1 KiB

  1. @echo off
  2. if "%1" == "" goto Usage
  3. if "%1" == "help" goto Usage
  4. if "%1" == "-?" goto Usage
  5. if "%1" == "/?" goto Usage
  6. if "%1" == "-help" goto Usage
  7. if "%1" == "/help" goto Usage
  8. setlocal
  9. set DriveLetter=%1
  10. set VolumePath=%1\
  11. set QueryVolumePath='%VolumePath%\'
  12. wmic volume where name=%QueryVolumePath% get name,capacity,freespace,dirtybitset
  13. if errorlevel 1 (
  14. echo volume not found
  15. goto :eof
  16. )
  17. echo ====
  18. echo ==== create a ShadowStorage
  19. echo ====
  20. @rem wmic shadowstorage call create "%VolumePath%", (200000000), "%VolumePath%"
  21. @rem the above does not work (WMIC bug 627473) workaround is below
  22. wmic shadowstorage call create %VolumePath%, 200000000, "%VolumePath%"
  23. echo ====
  24. echo ==== create a ShadowCopy
  25. echo ====
  26. wmic shadowcopy call create "ClientAccessible","%VolumePath%"
  27. echo ====
  28. echo ==== try to create the ShadowStorage again (should fail)
  29. echo ====
  30. @rem wmic shadowstorage call create "%VolumePath%",200000000,"%VolumePath%"
  31. @rem the above does not work (WMIC bug #) workaround is below
  32. wmic shadowstorage call create %VolumePath%, 200000000, "%VolumePath%"
  33. wmic volume where name=%QueryVolumePath% assoc /assocclass:Win32_ShadowFor
  34. echo ====
  35. echo ==== try to create the ShadowStorage again (should fail - bug)
  36. echo ==== provider failure because of AV in CStorage::Create method
  37. echo ====
  38. wmic shadowstorage call create "%VolumePath%",200000000,"%VolumePath%"
  39. wmic volume where name=%QueryVolumePath% assoc /assocclass:Win32_ShadowFor
  40. echo ====
  41. echo ==== List all ShadowCopy and ShadowStorage instances
  42. echo ====
  43. wmic shadowcopy list brief
  44. wmic shadowcopy list status
  45. wmic shadowcopy list full
  46. wmic shadowstorage list brief
  47. wmic shadowstorage list status
  48. wmic shadowstorage list full
  49. echo ====
  50. echo ==== Delete all ShadowCopy and ShadowStorage instances
  51. echo ====
  52. wmic shadowcopy delete
  53. wmic shadowstorage delete
  54. echo ====
  55. echo ==== List all ShadowCopy and ShadowStorage instances
  56. echo ====
  57. wmic shadowcopy list brief
  58. wmic shadowstorage list brief
  59. endlocal
  60. goto :eof
  61. :Usage
  62. echo wmicshadow driveLetter: