热门资讯更多>>
- 05-03[网站建设]关于IE6下绝对定位…
- 11-23[网站建设]jquery 做TABS切换…
- 02-13[网站建设]——dopostback缺…
- 07-14[网站优化]如何修改网站标题…
- 11-13[网站建设]SQLSERVER2005 数…
- 09-25[网站建设]屏蔽 Flash 右键的…
- 03-13[网站建设]Windows+ IIS 的手…
- 03-22[网站建设]谈谈如何利用网络…
- 03-04[网站建设]magento整合WORDP…
- 02-07[网站建设]MSSQL备份移植到另…
servu空间与实际空间对比脚本
On Error Resume Next
Dim WshShell, fso
Set WshShell = Wscript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Call main
Sub main()
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Dim strDir, strDiskQuota, strText
strComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Cat Soft\Serv-U\Domains\1\UserSettings"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
strText = "用户 空间大小 实际大小" & vbCrLf
For Each subkey In arrSubKeys
strDir = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Cat Soft\Serv-U\Domains\1\UserSettings\" & subkey & "\HomeDir")
If IsNull(strDir) Then strDir = "c:\winnt\temp"
strDiskQuota = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Cat Soft\Serv-U\Domains\1\UserSettings\" & subkey & "\DiskQuota")
If IsNull(strDiskQuota) Then strDiskQuota = "1|0|0"
''Wscript.sleep 10000
arrDiskQuota = Split(strDiskQuota, "|")
strFolderSize = ShowFolderSize(strDir)
If (CDbl(arrDiskQuota(1)) = 0) Or (CDbl(arrDiskQuota(1)) < CLng(strFolderSize)) Then
strText = strText & subkey & " " & arrDiskQuota(1) / 1024 / 1024 & " " & strFolderSize / 1024 / 1024 & vbCrLf
End If
Next
Call CreateAfile("Result.txt", strText)
Wscript.Echo "空间对比完成!"
End Sub
Function ShowFolderSize(filespec)
Dim f, s
If (fso.FolderExists(filespec)) Then
Set f = fso.GetFolder(filespec)
s = f.Size
Else
s = 0
End If
ShowFolderSize = s
End Function
Sub CreateAfile(strFileName, strText)
Dim MyFile
Set MyFile = fso.CreateTextFile(strFileName, True)
MyFile.WriteLine (strText)
MyFile.Close
End Sub
Set fso = Nothing
Dim WshShell, fso
Set WshShell = Wscript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Call main
Sub main()
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Dim strDir, strDiskQuota, strText
strComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Cat Soft\Serv-U\Domains\1\UserSettings"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
strText = "用户 空间大小 实际大小" & vbCrLf
For Each subkey In arrSubKeys
strDir = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Cat Soft\Serv-U\Domains\1\UserSettings\" & subkey & "\HomeDir")
If IsNull(strDir) Then strDir = "c:\winnt\temp"
strDiskQuota = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Cat Soft\Serv-U\Domains\1\UserSettings\" & subkey & "\DiskQuota")
If IsNull(strDiskQuota) Then strDiskQuota = "1|0|0"
''Wscript.sleep 10000
arrDiskQuota = Split(strDiskQuota, "|")
strFolderSize = ShowFolderSize(strDir)
If (CDbl(arrDiskQuota(1)) = 0) Or (CDbl(arrDiskQuota(1)) < CLng(strFolderSize)) Then
strText = strText & subkey & " " & arrDiskQuota(1) / 1024 / 1024 & " " & strFolderSize / 1024 / 1024 & vbCrLf
End If
Next
Call CreateAfile("Result.txt", strText)
Wscript.Echo "空间对比完成!"
End Sub
Function ShowFolderSize(filespec)
Dim f, s
If (fso.FolderExists(filespec)) Then
Set f = fso.GetFolder(filespec)
s = f.Size
Else
s = 0
End If
ShowFolderSize = s
End Function
Sub CreateAfile(strFileName, strText)
Dim MyFile
Set MyFile = fso.CreateTextFile(strFileName, True)
MyFile.WriteLine (strText)
MyFile.Close
End Sub
Set fso = Nothing