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

on error resume next
set objArgs = wscript.Arguments
if objArgs.count < 1 then
wscript.echo "Usage setDriveLetter <driveletter>:"
wscript.quit(1)
end if
strDriveLetter = objArgs(0)
'// Get the volume
strQuery = "select * from Win32_Volume where DriveLetter = '" & strDriveLetter & "'"
set VolumeSet = GetObject("winmgmts:").ExecQuery(strQuery)
for each obj in VolumeSet
set Volume = obj
exit for
next
wscript.echo "DriveLetter: " & strDriveLetter
Volume.DriveLetter = Null
Volume.Put_
if Err.Number <> 0 then
Set objLastError = CreateObject("wbemscripting.swbemlasterror")
wscript.echo("Provider: " & objLastError.ProviderName)
wscript.echo("Operation: " & objLastError.Operation)
wscript.echo("Description: " & objLastError.Description)
wscript.echo("StatusCode: 0x" & Hex(objLastError.StatusCode))
end if