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.

36 lines
1.2 KiB

  1. '//on error resume next
  2. strNamespace = "winmgmts://./root/cimv2"
  3. set objArgs = wscript.Arguments
  4. if objArgs.count < 1 then
  5. wscript.echo "Usage schedAutoChk volume1 [volume2 ...]"
  6. wscript.quit(1)
  7. end if
  8. Dim astrVolumes()
  9. Redim astrVolumes(objArgs.count-1)
  10. For i = 0 to objArgs.count-1
  11. astrVolumes(i) = objArgs(i)
  12. Next
  13. set Volume = GetObject(strNamespace & ":Win32_Volume")
  14. Result = Volume.ScheduleAutoChk(astrVolumes)
  15. strMessage = MapErrorCode("Win32_Volume", "ScheduleAutoChk", Result)
  16. wscript.echo "Volume.ScheduleAutoChk returned: " & Result & " : " & strMessage
  17. Function MapErrorCode(ByRef strClass, ByRef strMethod, ByRef intCode)
  18. set objClass = GetObject("winmgmts:").Get(strClass, &h20000)
  19. set objMethod = objClass.methods_(strMethod)
  20. values = objMethod.qualifiers_("values")
  21. if ubound(values) < intCode then
  22. wscript.echo " FAILURE - no error message found for " & intCode & " : " & strClass & "." & strMethod
  23. f.writeline ("FAILURE - no error message found for " & intCode & " : " & strClass & "." & strMethod)
  24. MapErrorCode = ""
  25. else
  26. MapErrorCode = values(intCode)
  27. end if
  28. End Function