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.

42 lines
1.4 KiB

  1. strNamespace = "winmgmts://./root/cimv2"
  2. MaxDiffSpace = 200000000
  3. '// Pick a target volume
  4. set VolumeSet = GetObject(strNamespace).ExecQuery(_
  5. "select * from Win32_Volume where Name='C:\\'")
  6. for each obj in VolumeSet
  7. set Volume = obj
  8. exit for
  9. next
  10. wscript.echo "Volume Name: " & Volume.Name
  11. set DiffVolumeSet = GetObject(strNamespace).ExecQuery(_
  12. "select * from Win32_Volume where Name='C:\\'")
  13. for each obj in DiffVolumeSet
  14. set DiffVolume = obj
  15. exit for
  16. next
  17. wscript.echo "DiffVolume Name: " & DiffVolume.Name
  18. set Storage = GetObject(strNamespace & ":Win32_ShadowStorage")
  19. Result = Storage.Create(Volume.Name, DiffVolume.Name)
  20. strMessage = MapErrorCode("Win32_ShadowStorage", "Create", Result)
  21. wscript.echo "Storage.Create returned: " & Result & " : " & strMessage
  22. Function MapErrorCode(ByRef strClass, ByRef strMethod, ByRef intCode)
  23. set objClass = GetObject("winmgmts:").Get(strClass, &h20000)
  24. set objMethod = objClass.methods_(strMethod)
  25. values = objMethod.qualifiers_("values")
  26. if ubound(values) < intCode then
  27. wscript.echo " FAILURE - no error message found for " & intCode & " : " & strClass & "." & strMethod
  28. f.writeline ("FAILURE - no error message found for " & intCode & " : " & strClass & "." & strMethod)
  29. MapErrorCode = ""
  30. else
  31. MapErrorCode = values(intCode)
  32. end if
  33. End Function