Code:
EL_SUCCESS = 0
EL_ERROR = 1
EL_WARNING = 2
EL_INFO = 4
EL_AUDIT_SUCCESS = 8
EL_AUDIT_FAILURE = 16
Set WshShell = CreateObject("WScript.Shell")
set oFs = WScript.CreateObject("Scripting.FileSystemObject")
set oDrives = oFs.Drives
for each oDrive in oDrives
if odrive.driveletter = "C" then
percent_used_tmp= (oDrive.freeSpace /oDrive.TotalSize)*100
res1=instr(percent_used_tmp,".")
percent_used = Left(percent_used_tmp,res1 + 2)
if percent_used < 100 then
percent_used= 100 - percent_used
end if
if percent_used = 100 then
MsgBox " Please Check Drive Space."& vbcrlf & _
" "& vbcrlf & _
" WARNING!" & vbcrlf & _
" You are out of disk space on the server! " & vbcrlf & _
" You must delete unnecessary files" & vbcrlf & _
" You are not able to save files on the server at this time.",48, "You are out of disk space on the server!"
elseif percent_used > 85 then
MsgBox " Please check Drive Space ."& vbcrlf & _
" "& vbcrlf & _
" WARNING!" & vbcrlf & _
" You have utilized " & percent_used & "% of your allocated disk space on the server." & vbcrlf & _
" You are not able to save files on the server at this time.",48, "You are out of disk space on the server!"
WriteToEventLog EL_Warning, "successful..."
sub WriteToEventLog(sLogEID,strELMessage)
objShell.LogEvent sLogEID, strELMessage
elseif percent_used < 85 then
'*msgbox "it works",48, "Reminder"
end if
end if
next
Comment