Submitted By: Ishpreet Gill

Displays the amount of disk used on a user's home drive.

Visual Basic
Edit|Remove
Option Explicit

Dim oFSO, oDrive, oDriveH, oNetwork, sUserName, fQuota

set oFSO = CreateObject("Scripting.FileSystemObject")

If oFSO.DriveExists("H:") = 0 Then 
	MsgBox " ""Your home drive could not be mounted"". " & VbCrLf & _
	"Inform Systems Administrator about the above error.", 16, "MyQuota"
	WScript.Quit 
End If 

Set oDriveH = oFSO.GetDrive("H:")
Set oNetwork = CreateObject("WScript.Network")
sUserName = oNetwork.UserName
fQuota = round(oDriveH.AvailableSpace/1000000, 2)

If fQuota > 25 Then 
	MsgBox "Disk quota remaining for " & sUserName & " : " & _
	fQuota & " " & " MB", 64, "MyQuota"
Elseif fQuota <25 And fQuota > 10 Then 
	MsgBox "Disk quota remaining for " & sUserName & " : " & _
 	fQuota & " " & " MB", 48, "MyQuota"
Else 
	MsgBox "Disk quota remaining for " & sUserName & " : " & _
 	fQuota & " " & " MB" & VbCrLf & "Your quota has gone too low."& _
 	"Start deleting old files that are not required.", 16, "MyQuota"
End If