VBScript unter XP sehr langsam
Huhu,
ich nutze ein einfaches VBScript, um das Alter von Dateien im einem Verzeichnis zu messen.
Unter windows 2000 server und WS sowie unter windwos 2003 server klappt das Script hervorragend.
Unter Windows XP allerdings kommt der Output, dann dauet es allerdings noch ca. 10 sec. bis wieder der Laufwerksprompt erscheint.
Irgendjemand eine Idee, warum das so ist ? Nach dem Echo kommt nämlich nur noch ein Quit, sonst nix
Das Script:
Const intOK = 0
Const intWarning = 1
Const intCritical = 2
Const intUnknown = 3
'Verzeichnis wo gesucht werden soll
strFolderName = "c:\verzeichnis\"
'Anzahl der Minuten von Jetzt. Datei dessen Alter jünger als dieser Wert ist,
strMinute = 1440
Dim FileCount
FileCount = 0
Dim strDatediffmax
strDatediffmax = 3601
Set fso = CreateObject("Scripting.FileSystemObject")
Set myFolder = fso.GetFolder(strFolderName)
Set myFiles = myFolder.Files
for each myFile in myFiles
dtmDateLastModified = myFile.DateLastModified
' --- vergleiche das Alter der Datei mit der aktuellen Zeit
if DateDiff("n", dtmDateLastModified, now) < strMinute Then
FileCount = FileCount+1
If DateDiff("n", dtmDateLastModified, now)< strDatediffmax Then
strDatediffmax = DateDiff("n", dtmDateLastModified, now)
End If
'Debug
'Wscript.Echo DateDiff("n", dtmDateLastModified, now)
end If
next
If FileCount > 0 Then
Wscript.Echo "OK: "
Wscript.Quit(intOK)
Else
Wscript.Echo "CRITICAL:
Wscript.Quit(intCritical)
End If
ich nutze ein einfaches VBScript, um das Alter von Dateien im einem Verzeichnis zu messen.
Unter windows 2000 server und WS sowie unter windwos 2003 server klappt das Script hervorragend.
Unter Windows XP allerdings kommt der Output, dann dauet es allerdings noch ca. 10 sec. bis wieder der Laufwerksprompt erscheint.
Irgendjemand eine Idee, warum das so ist ? Nach dem Echo kommt nämlich nur noch ein Quit, sonst nix
Das Script:
Const intOK = 0
Const intWarning = 1
Const intCritical = 2
Const intUnknown = 3
'Verzeichnis wo gesucht werden soll
strFolderName = "c:\verzeichnis\"
'Anzahl der Minuten von Jetzt. Datei dessen Alter jünger als dieser Wert ist,
strMinute = 1440
Dim FileCount
FileCount = 0
Dim strDatediffmax
strDatediffmax = 3601
Set fso = CreateObject("Scripting.FileSystemObject")
Set myFolder = fso.GetFolder(strFolderName)
Set myFiles = myFolder.Files
for each myFile in myFiles
dtmDateLastModified = myFile.DateLastModified
' --- vergleiche das Alter der Datei mit der aktuellen Zeit
if DateDiff("n", dtmDateLastModified, now) < strMinute Then
FileCount = FileCount+1
If DateDiff("n", dtmDateLastModified, now)< strDatediffmax Then
strDatediffmax = DateDiff("n", dtmDateLastModified, now)
End If
'Debug
'Wscript.Echo DateDiff("n", dtmDateLastModified, now)
end If
next
If FileCount > 0 Then
Wscript.Echo "OK: "
Wscript.Quit(intOK)
Else
Wscript.Echo "CRITICAL:
Wscript.Quit(intCritical)
End If
Please also mark the comments that contributed to the solution of the article
Content-Key: 43815
Url: https://administrator.de/contentid/43815
Printed on: April 25, 2024 at 02:04 o'clock