Disk Space Checking

On Error Resume Next

Dim fso, DiskDriver,DD,Showfreespace,Totalsizespace,SizePercent

Dim SendmailPermission

SendmailPermission = 0

Set fso = wscript.createobject("scripting.filesystemobject")

If (fso.folderexists("C:\Disk2")) = False then

Set foldr=fso.createfolder("C:\Disk2")

End if

Set tf = fso.CreateTextFile("c:\Disk2\DiskSpacelog.txt", True)

Set Drivers = fso.Drives

For Each DiskDriver in Drivers

‘list all drives in the computer

DD = DiskDriver.DriveLetter

Set drv = fso.GetDrive( DD & ":")

s=drv.DriveType

If s = 2 And DD <> "Q" Then

Showfreespace = DD & " Local Disk Free Space is " & FormatNumber (drv.FreeSpace/1024/1024/1024,1) & "GB"

‘WScript.Echo Showfreespace

tf.WriteLine Showfreespace

Totalsizespace = DD & " Local Disk Total Size is " & FormatNumber (drv.TotalSize/1024/1024/1024,1) & "GB"

‘WScript.Echo Totalsizespace

‘tf.WriteLine Totalsizespace

SizePercentNumber= drv.FreeSpace / drv.TotalSize * 100

SizePercent = "Free Space Size Percent is " & FormatNumber (drv.FreeSpace / drv.TotalSize * 100,2) & "%"

‘WScript.Echo SizePercent

tf.WriteLine SizePercent

tf.WriteLine "=================================="

Showfreespace = Null

Totalsizespace = Null

SizePercent = Null

If SizePercentNumber < 11 Then

SendmailPermission = 1

End If

End If

Next

MyDate = "Checking Date is " & Date

tf.WriteLine MyDate

tf.Close()

If SendmailPermission = 1 Then

sendmailresult=SendMail("[email protected]","Welcome1","[email protected]","Warning:Low Free Disk Space On Srv10101", "Warning:free disk space is less than 11% on Srv10101 !!!","C:\disk2\DiskSpacelog.txt")

‘sendmailresult=SendMail("[email protected]","Welcome1","[email protected]","Srv10101 Disk Space Checking", "Warning:Srv10101 have low free disk space !!!","C:\disk2\DiskSpacelog.txt")

End If

Function SendMail(SendFrom,Password,SendTo,MailTopic,MailBody,MailAttachment)

On error resume next

MS_Space = "http://schemas.microsoft.com/cdo/configuration/"

Set Email = CreateObject("CDO.Message")

Email.BodyPart.Charset = "GBK"

Email.From = SendFrom

Email.To = SendTo

Email.Subject = MailTopic

Email.Htmlbody = MailBody

If MailAttachment <> "" Then

For i=0 to Ubound(Split(MailAttachment,";"))

Email.AddAttachment Split(MailAttachment,";")(i)

Next

End If

With Email.Configuration.Fields

.Item(MS_Space&"sendusing") = 2

.Item(MS_Space&"smtpserver") = "smtp."&Split(SendFrom,"@",-1, vbTextCompare)(1)

.Item(MS_Space&"smtpserverport") = 25

.Item(MS_Space&"smtpauthenticate") = 1

.Item(MS_Space&"sendusername") =Split(SendFrom,"@",-1,vbTextCompare)(0)

.Item(MS_Space&"sendpassword") = Password

.Update

End With

Err.clear

Email.Send

If Err.number<>0 Then

SendMail=False

Else

SendMail=True

End If

Set Email=Nothing

End Function

时间: 2024-08-29 13:14:35

Disk Space Checking的相关文章

[转]Disk Space Usage and SQL Server Performance

Disk Space Usage and SQL Server Performance By Gregory A. Larsen When you think of SQL Server performance components, you think of the usage of CPU, memory, and the I/O it takes to process a query. However, there is another component you should consi

linux下如何查看disk space硬盘应用情况

主要是运用 df 指令,df是disk filesystem的缩写 其后面还可以加很多有用的tag df -h 以适合人类阅读的格式显示,也就是把容量以多少G(giga bytes),多少M为单位来显示 df -a 则是打印出最全的信息 以上两种便是最常用的了,若欲了解其他用法,可以查看 http://www.tecmint.com/how-to-check-disk-space-in-linux/ 或者直接 df --help得到帮助信息 linux下如何查看disk space硬盘应用情况

Not enough free disk space on disk &#39;/boot&#39;(转载)

转自:http://m.oschina.net/blog/277224 # 解决 出现此情况是因为你的boot分区是单独分区的,像我只给了100M,以前装ubuntu时没有出现,所以当出现这个提示时,很纳闷,发现了答案. 为什么boot分区会满? 主要是存放了一些老的linux image镜像文件. SO, 我们想查看我们boot分区有那些linux image,使用命令: dpkg -l | grep linux-image 我们发现有 linux-image-3.13.0-24-generi

How to get the free disk space in PostgreSQL (PostgreSQL获取磁盘空间)

Get the current free disk space in PostgreSQL PostgreSQL获取磁盘空间 Here has a simple way to get free disk space without any extended language, just define a function using pgsql. CREATE OR REPLACE FUNCTION sys_df() RETURNS SETOF text[] LANGUAGE plpgsql $

Ora-19804: Cannot reclaim 45561856 bytes disk space from 8589934592 limit

启动数据库到Nomount: startup nomount 扩大闪回恢复区的大小:show parameter db_recovery 执行SQL语句:alter system set db_recovery_file_dest_size=5g scope=both; 打开数据库:alter database mount; 打开数据库:alter database open; 进入RMAN模式:rman target sys/admin nocatalog RMAN删除过期的备份文件与归档文件

jenkins出现Disk space is too low /tmp left

今天刚刚配置完毕jenkins突然出现构建项目的时候一直卡在 pending上面于是查看了一下 提示说是 tmp目录太小,不足1GB,需要添加但是磁盘已经分完了,于是修改一下jenkins的free的需求保存,解决 原文地址:http://blog.51cto.com/9025736/2061679

Not enough disk space to create volume shadow copy

Solution: Run the following command before doing backup : reagent.exe /disable (it is to disable the recovery agent.) Remember to re-enable it after the backup is done. reagent.exe /enable 原文地址:https://blog.51cto.com/549687/2439162

vSphere Client 虚拟机报错:There is no more space for virtual disk

故障描述: 开发人员说192.168.xxx.216连接不上了,ping不通. 因为这个是物理机虚拟出来的linux虚拟机,通过vsphere client登录,发现操作界面报错如下: There is no more space for virtual disk 192.168.xxx.216 you might be able to continue this session by freeing disk space on the relevant volume,and clicking

esxi报错There is no more space for virtual disk--逻辑卷缩减!

来自 localhost.localdomain 的消息: There is no more space for virtual disk ftp-000001.vmdk. You might be able to continue this session by freeing disk space on the elevant volume, and clicking _Retry. Click Cancel to terminate this session.  问题:磁盘空间分配不合理.