Path not found? Are you getting an issue with netbios
name resolution for that? Maybe not returning fast enough for the
script?
How about the security and system logs for this one?
Anything there?
Al
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael B. Smith
Sent: Wednesday, October 13, 2004 9:00 AM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] OT sorta: GetDrive() error
OK, I'm logged in as a Domain Admin and an
Enterprise Admin on our domain. My desktop
is a member of the domain.
I have one server,
which is a member of the domain, it is not a
DC, running Windows 2000 Server, sp4, that if I don't create a
mapped share (and authenticate separately) that the script below fails
with:
Error 0x4C occurred in GetDrive for: \\aspen\c$
Error 0x4c is error 76 in decimal, and means: "Path not found". But if I map anything to that server (C$, D$, IPC$), using my domain login, the script will then work fine.I've got 40+ servers where this works fine. Just this one doesn't.
Any one of you gurus have any ideas why this might be failing?
Thanks so much!
Michael
' Display info for
specified drive
Option
Explicit
Dim objFSO, objDrv, iLimit
Dim objFSO, objDrv, iLimit
On Error Resume
Next
' Get absolute path
name from command line, then get optional percentage available
If Wscript.Arguments.Count < 1 or Wscript.Arguments.Count > 2 Then
wscript.echo "drivespace.vbs UNC-path [percent-available]"
wscript.echo "EX: drivespace.vbs \\server\c$ 10"
Wscript.Quit(1)
End If
If Wscript.Arguments.Count < 1 or Wscript.Arguments.Count > 2 Then
wscript.echo "drivespace.vbs UNC-path [percent-available]"
wscript.echo "EX: drivespace.vbs \\server\c$ 10"
Wscript.Quit(1)
End If
If
Wscript.Arguments.Count > 1 Then
iLimit = CInt (Wscript.Arguments (1))
Else
iLimit = 101
End If
iLimit = CInt (Wscript.Arguments (1))
Else
iLimit = 101
End If
Set objFSO =
CreateObject ("Scripting.FileSystemObject")
ErrorReport "CreateObject"
ErrorReport "CreateObject"
' Get drive object
and display properties
IterateGetDrive WScript.Arguments (0)
IterateGetDrive WScript.Arguments (0)
With
objDrv
If ((.FreeSpace / .TotalSize) * 100) < iLimit Then
Wscript.Echo " Share :", Wscript.Arguments (0)
Wscript.Echo " % Free :", FormatPercent ((.FreeSpace / .TotalSize), 1)
Wscript.Echo " Bytes Available :", FormatNumber (.AvailableSpace, 0)
Wscript.Echo " Bytes Used :", FormatNumber ((.TotalSize - .FreeSpace), 0)
Wscript.Echo " Total Bytes :", FormatNumber (.TotalSize, 0)
Wscript.Echo " "
End If
End With
If ((.FreeSpace / .TotalSize) * 100) < iLimit Then
Wscript.Echo " Share :", Wscript.Arguments (0)
Wscript.Echo " % Free :", FormatPercent ((.FreeSpace / .TotalSize), 1)
Wscript.Echo " Bytes Available :", FormatNumber (.AvailableSpace, 0)
Wscript.Echo " Bytes Used :", FormatNumber ((.TotalSize - .FreeSpace), 0)
Wscript.Echo " Total Bytes :", FormatNumber (.TotalSize, 0)
Wscript.Echo " "
End If
End With
Set objFSO =
Nothing
Sub ErrorReport
(strErr)
'wscript.echo "in ErrorReport for: " & strErr
If Err.Number <> 0 Then
Wscript.Echo "Error 0x" & CStr (Hex (Err.Number)) & " occurred in " & strErr & " for: " & Wscript.Arguments (0)
If Err.Description <> "" Then
Wscript.Echo "Error description: " & Err.Description
End If
'wscript.echo "in ErrorReport for: " & strErr
If Err.Number <> 0 Then
Wscript.Echo "Error 0x" & CStr (Hex (Err.Number)) & " occurred in " & strErr & " for: " & Wscript.Arguments (0)
If Err.Description <> "" Then
Wscript.Echo "Error description: " & Err.Description
End If
set
objFSO = Nothing
wscript.quit (1)
End If
End Sub
wscript.quit (1)
End If
End Sub
' GetDrive() fails
inconsistently. I don't know why. So,
' iterate a few times to try to get the real answer.
Sub IterateGetDrive (strDrive)
Dim i
' iterate a few times to try to get the real answer.
Sub IterateGetDrive (strDrive)
Dim i
On Error
Resume Next
For i = 0 To
5
Err.Clear
Set objDrv = objFSO.GetDrive (strDrive)
If Err.Number = 0 Then
Exit Sub
End If
Next
ErrorReport "GetDrive"
End Sub
Err.Clear
Set objDrv = objFSO.GetDrive (strDrive)
If Err.Number = 0 Then
Exit Sub
End If
Next
ErrorReport "GetDrive"
End Sub
