4.1版
9 Z: U7 Z2 M3 i z
用法同前
0 Q' ^& O6 X" `" G: h
脚本名 目录名
# ~3 t0 D( Y! C5 M9 B* E3 G
在目录名下生成一个文件,按用户次序输出所有用户在该目录中的文件信息,格式如下:
! Q2 \8 Y8 m: a* _! C" I! S: Q8 F0 \1 V8 h' j9 t
--------------------------------------------------------------
3 q* i4 p0 H! c* h2 i1 a) j9 mThe TotalSize of All files Administrator owns is: 0MB
0 G" X- s" ` J" {1 Z/ W- w0 ~& Q
--------------------------------------------------------------
7 m5 R, k" F' S/ g# B$ y9 c※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
+ e! F$ i2 E) j--------------------------------------------------------------
. ?% f( `" A4 @+ |: N# m- G$ f
The TotalSize of All files Guest owns is: 0MB
6 E+ Y/ c! q9 B) b9 k--------------------------------------------------------------
5 d9 r* U( m" c- u
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
- x0 e+ `0 r c; h6 e9 n--------------------------------------------------------------
5 |+ g b' ?. O: wThe TotalSize of All files HelpAssistant owns is: 0MB
( |, y5 v, g, H5 O, n- c. W
--------------------------------------------------------------
% z) Z$ {1 |! C0 Q
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
! i$ ~% S1 B1 n# P" u- u* z6 ^
--------------------------------------------------------------
% a: N# E9 l" C+ K) ]
d:\powerword 2003.rar
: V" J( Y3 s! V4 v! O& eType: WinRAR 档案文件
- k6 L3 d/ Z0 M+ A& `
Size: 503MB
0 f" N. L- W( K2 ]; W
--------------------------------------------------------------
- v4 _6 M4 v/ D) a7 m9 ~4 q
d:\年 度 考 核 登 记 表2006版061225.doc
3 S5 L6 `- o* ^: f: tType: Microsoft Word 文档
3 `/ z) R+ y+ X
Size: 0MB
5 s/ V2 x9 _# A) E6 d% X% x--------------------------------------------------------------
, [% Y* R" w; t! o( Sd:\jcb-gx
$ G' ^2 l* \% mType: File Folder
! j6 ]* q6 y, l
Size: 22MB
$ a# j f; }" V# `5 Y--------------------------------------------------------------
4 w2 f0 l/ a: M5 m2 W o# t2 U* cThe TotalSize of All files lsj owns is: 525MB
$ @7 t; l" p$ j; U# P/ }+ k
--------------------------------------------------------------
- P- J; v6 [* Z9 q0 B" ~※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
2 y9 n) d. X( F$ \! z7 B: K' {0 Z @
--------------------------------------------------------------
) G1 Q3 T" E; S5 O7 h$ n, c* V8 o5 ^
The TotalSize of All files SUPPORT_388945a0 owns is: 0MB
* K0 _$ U; ?& U/ g1 Z
--------------------------------------------------------------
& e0 o1 E/ s9 }; F/ s
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
复制内容到剪贴板
代码:
G = WScript.arguments(0)
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set objWMI = GetObject("winmgmts:")
Set oFiles = objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"&G&"'}" & "where ResultClass = CIM_logicalfile")
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set colAccounts = GetObject("WinNT://" & strComputer & "")
colAccounts.Filter = Array("user")
For Each objUser In colAccounts
TotalSize = 0
H = objUser.Name
Set TXT = oFSO.OpenTextFile(G&"\TXT.TXT",8,true)
For Each oFile In oFiles
strFile = oFile.name
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile & "'}" & " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
For Each objItem in colItems
if objItem.AccountName = H then
TXT.WriteLine( "--------------------------------------------------------------")
TXT.WriteLine( oFile.name)
TXT.WriteLine( "Type: " & oFile.FileType)
if oFile.name = G&"system volume information" then
exit for
end if
S = 0
if oFile.FileType="File Folder" then
Set objFolder = oFSO.GetFolder(oFile.name)
S= Cint(objFolder.Size/1024/1024)
else
S= Cint(oFile.FileSize/1024/1024)
end if
TXT.WriteLine( "Size: " & S &"MB")
TotalSize = TotalSize + S
end if
Next
Next
TXT.WriteLine( "--------------------------------------------------------------")
TXT.WriteLine( "The TotalSize of All files "&H&" owns is: " & TotalSize &"MB")
TXT.WriteLine( "--------------------------------------------------------------")
TXT.WriteLine( "※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")
TXT.Close
Next
MsgBox "文件列表信息已成功输出至TXT.TXT文件",64,"OK"[
本帖最后由 lgaint 于 2007-11-28 00:13 编辑 ]