Ik krijg deze foutmelding als onderstaand script run, hoe kan ik dit script (aantal MB per directory) draaiend krijgen? Wat zit er fout?


code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
| Dim ExcelSheet, InputMap
Set ExcelSheet = CreateObject("Excel.sheet")
'ExcelSheet.Visible = True
InputMap = InputBox("Naam van een bestaande map vermelden inclusief \ bijv c:\windows", "Excelbestand maken van mapgrootte")
if len( inputmap) > 3 then
reportfolderstatus(InputMap)
end if
WScript.Quit
'---------------
Function ReportFolderStatus(fldr)
Dim fso, msg, uur, minuut, seconde
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(fldr)) Then
msg = Ucase(fldr) & " bestaat !"
ReportFolderStatus = msgbox (msg, ,"Resultaat van controle op aanwezigheid map")
showfolderlist(fldr)
uur = Hour(now)
if (len(trim(uur)) = 1) then
uur = "0" + Right(trim(uur), 1)
end if
minuut = minute(now)
if (len(trim(minuut)) = 1) then
minuut = "0" + Right(trim(minuut), 1)
end if
seconde = second(now)
if (len(trim(seconde)) = 1) then
seconde = "0" + Right(trim(seconde), 1)
end if
tijd = uur & "."& minuut & "." & seconde
datum = Date
' naam = "c:\" & datum & "_" & tijd & ".XLS"
naam = "k:\systeembeheer\quota\" & date& "_" & tijd & ".XLS"
ExcelSheet.SaveAs naam
ExcelSheet.application.Quit
Set ExcelSheet = Nothing
a =msgbox ("Excel bestand weggeschreven met de naam: " & naam,, "Gereed")
Else
msg = fldr & " bestaat niet, programma wordt gestopt."
ReportFolderStatus = msgbox (msg, ,"Controle op aanwezigheid van de map")
End If
'ReportFolderStatus = msgbox (msg)
End Function
Function ShowFolderList(folderspec)
Dim fso, f, f1, s ,s1, s2, s3, s4, sf, teller, strUserName
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set sf = f.SubFolders
Set WSHNetwork = CreateObject("WScript.Network")
While strUserName = ""
strUserName = trim(WSHNetwork.UserName)
WEnd
teller =2
ExcelSheet.ActiveSheet.Cells(1,1).Value = folderspec & " d.d. "& date() & " " & time() & " " & " gegenereerd door " & strUserName
ExcelSheet.ActiveSheet.Cells(2,1).Value = "Naam map"
ExcelSheet.ActiveSheet.Cells(2,2).Value = "Mb in gebruik"
s_tot =(f.size/(1024*1024))
For Each f1 in sf
s1 = s & f1.name
s2 = f1.size/(1024*1024)
s3 = round(s2, 2)
if s2 > 1 then
' test = msgbox (s2 , , s1)
teller = teller +1
ExcelSheet.ActiveSheet.Cells(teller,1).Value = s1
ExcelSheet.ActiveSheet.Cells(teller,2).Value = s3
s4 = s4+ s3
else
s4 = s4
end if
Next
' ExcelSheet.ActiveSheet.Cells(teller+1,1).Value = "Hoofddir."
' excelsheet.activesheet.cells(teller+1,2).value = round((s_tot-s4),2)
ExcelSheet.ActiveSheet.Cells(teller+2,1).Value = "Totaal Mb"
excelsheet.activesheet.cells(teller+2,2).value = round(s_tot,2)
ExcelSheet.ActiveSheet.Cells(teller+3,1).Value = "Gereed " & time()
End Function
'Dim strUserName
'Set WSHNetwork = CreateObject("WScript.Network")
'While strUserName = ""
' strUserName = trim(WSHNetwork.UserName)
' test = msgbox (strUserName,,"Testen login userName")
'WEnd |