Hi,I'm fairly new to VBScript and can't figure out what is wrong with the statement below. Basically, I'm trying to check for available freespace on two different drives and I plan on sending an email if the freespace is below a certain amount for each drive. I stuck in some Wscript.Echo commands to make sure the values were what I thought they were, and sure enough they were. My C: drive is 0.598 and F is 0.065, but when I execute this code, "str" is always set to null. It never executes the then clause on either if statement. What is wrong with my If statement?
Code:
str = ""
set oFs = WScript.CreateObject("Scripting.FileSystemObject")
set oDrives = oFs.Drives
strComputerName = GetCurrentComputerName
For Each oDrive In oDrives
Select Case oDrive.DriveType
Case Fixed
WScript.Echo oDrive.DriveLetter & " " & (Round (oDrive.FreeSpace / oDrive.TotalSize, 3))
If oDrive.DriveLetter= C And Round(oDrive.FreeSpace / oDrive.TotalSize, 3) < 0.7 Then
str = str & strComputerName & " " & oDrive.DriveLetter & " " & Round(oDrive.FreeSpace / oDrive.TotalSize, 2) & vbCrLf
End If
If oDrive.DriveLetter= F And Round(oDrive.FreeSpace / oDrive.TotalSize, 3) < 0.10 Then
str = str & strComputerName & " " & oDrive.DriveLetter & " " & Round(oDrive.FreeSpace / oDrive.TotalSize, 2) & vbCrLf
End If
WScript.Echo 'str = ' str
End Select
Next