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.

33 lines
895 B

  1. on error resume next
  2. set objArgs = wscript.Arguments
  3. if objArgs.count < 1 then
  4. wscript.echo "Usage setDriveLetter <driveletter>:"
  5. wscript.quit(1)
  6. end if
  7. strDriveLetter = objArgs(0)
  8. '// Get the volume
  9. strQuery = "select * from Win32_Volume where DriveLetter = '" & strDriveLetter & "'"
  10. set VolumeSet = GetObject("winmgmts:").ExecQuery(strQuery)
  11. for each obj in VolumeSet
  12. set Volume = obj
  13. exit for
  14. next
  15. wscript.echo "DriveLetter: " & strDriveLetter
  16. Volume.DriveLetter = Null
  17. Volume.Put_
  18. if Err.Number <> 0 then
  19. Set objLastError = CreateObject("wbemscripting.swbemlasterror")
  20. wscript.echo("Provider: " & objLastError.ProviderName)
  21. wscript.echo("Operation: " & objLastError.Operation)
  22. wscript.echo("Description: " & objLastError.Description)
  23. wscript.echo("StatusCode: 0x" & Hex(objLastError.StatusCode))
  24. end if