Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Folder size script

Reply
 
Old 07-27-2009   #1 (permalink)
mcgowankm


 
 

Folder size script

I'm running a vbs script that gets the size of folders on another server.
The basics of the script is:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("\\cet-vcl-021\xxxx$\Profiles")

I can get most folders but not profile folders. I get the error
"foldersize.vbs(3, 1) Microsoft VBScript runtime error: Permission denied" I
am running the script with a domain admin account. I can go into properties
for the folder and get the info I need why not by script?

Thanks,
Kevin


My System SpecsSystem Spec
Old 07-27-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: Folder size script


"mcgo****m" <mcgo****m@xxxxxx> wrote in message
news:04D1D110-F791-47BE-96E5-1E5A72FDF10F@xxxxxx
Quote:

> I'm running a vbs script that gets the size of folders on another server.
> The basics of the script is:
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objFolder = objFSO.GetFolder("\\cet-vcl-021\xxxx$\Profiles")
>
> I can get most folders but not profile folders. I get the error
> "foldersize.vbs(3, 1) Microsoft VBScript runtime error: Permission denied"
> I
> am running the script with a domain admin account. I can go into
> properties
> for the folder and get the info I need why not by script?
>
> Thanks,
> Kevin
>
I tested your script on my machine, replacing "Profiles" with "Documents and
Settings". It worked perfectly. This makes me suspect that you have a folder
inside the Profiles folder that is hidden and inaccessible to you, even as a
domain admin. Since it's hidden, you may not be aware of its existence but
it will trip up your script.

A few weeks ago I wrote a script for someone who wanted a list of all
inaccessible folders. You could use it to confirm if my suspicion is
correct - see below.
[01] '---------------------------
[02] 'Locate inaccessible folders
[03] '22.6.2009 FNL
[04] '---------------------------
[05] sSource = "\\cet-vcl-021\xxxx$\Profiles"
[06] sLogFile = "d:\Inaccessible.txt"
[07] Dim sPath, iCount, oFSO
[08] Set oFSO = CreateObject("Scripting.FileSystemObject")
[09]
[10] '-----------------------
[11] 'Check script parameters
[12] '-----------------------
[13] If Not oFSO.FolderExists(sSource) _
[14] Then ErrorExit ("The folder " & sSource & " does not exist.")
[15]
[16] On Error Resume Next
[17] Set oLogFile = oFSO.CreateTextFile(sLogFile, True)
[18] If Err.number > 0 _
[19] Then ErrorExit "Cannot open " & sLogFile & vbLf & Err.Description
[20] On Error Goto 0
[21]
[22] '-------------------------------------
[23] 'Recursively scan the nominated folder
[24] '-------------------------------------
[25] iCount = 0
[26] CheckFolder oFSO.GetFolder(sSource)
[27] oLogFile.Close
[28] MsgBox iCount & " inaccessible folder(s) found." & vbLf _
[29] & "Check the file " & sLogFile & " for details."
[30]
[31] '---------------
[32] 'Scan one folder
[33] '---------------
[34] Sub CheckFolder (oFldr)
[35] On Error Resume Next
[36] For Each oSubfolder In oFldr.Subfolders
[37] If IsEmpty (oSubfolder) Then
[38] oLogFile.WriteLine "***Error*** """ & sPath & """"
[39] Err.Clear
[40] iCount = iCount + 1
[41] Else
[42] sPath = oSubfolder.path
[43] CheckFolder oSubfolder
[44] End If
[45] Next
[46] End Sub
[47]
[48] Sub ErrorExit (msg)
[49] MsgBox msg
[50] WScript.Quit 1
[51] End Sub


My System SpecsSystem Spec
Old 07-27-2009   #3 (permalink)
mcgowankm


 
 

Re: Folder size script

Thanks. I can see the problems I still dont' understand why when I click on
the folder in Windows Explorer and check properties it gives me the size of
the folder. Is there no way to ge the same result in a script?

"Pegasus [MVP]" wrote:
Quote:

>
> "mcgo****m" <mcgo****m@xxxxxx> wrote in message
> news:04D1D110-F791-47BE-96E5-1E5A72FDF10F@xxxxxx
Quote:

> > I'm running a vbs script that gets the size of folders on another server.
> > The basics of the script is:
> >
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > Set objFolder = objFSO.GetFolder("\\cet-vcl-021\xxxx$\Profiles")
> >
> > I can get most folders but not profile folders. I get the error
> > "foldersize.vbs(3, 1) Microsoft VBScript runtime error: Permission denied"
> > I
> > am running the script with a domain admin account. I can go into
> > properties
> > for the folder and get the info I need why not by script?
> >
> > Thanks,
> > Kevin
> >
>
> I tested your script on my machine, replacing "Profiles" with "Documents and
> Settings". It worked perfectly. This makes me suspect that you have a folder
> inside the Profiles folder that is hidden and inaccessible to you, even as a
> domain admin. Since it's hidden, you may not be aware of its existence but
> it will trip up your script.
>
> A few weeks ago I wrote a script for someone who wanted a list of all
> inaccessible folders. You could use it to confirm if my suspicion is
> correct - see below.
> [01] '---------------------------
> [02] 'Locate inaccessible folders
> [03] '22.6.2009 FNL
> [04] '---------------------------
> [05] sSource = "\\cet-vcl-021\xxxx$\Profiles"
> [06] sLogFile = "d:\Inaccessible.txt"
> [07] Dim sPath, iCount, oFSO
> [08] Set oFSO = CreateObject("Scripting.FileSystemObject")
> [09]
> [10] '-----------------------
> [11] 'Check script parameters
> [12] '-----------------------
> [13] If Not oFSO.FolderExists(sSource) _
> [14] Then ErrorExit ("The folder " & sSource & " does not exist.")
> [15]
> [16] On Error Resume Next
> [17] Set oLogFile = oFSO.CreateTextFile(sLogFile, True)
> [18] If Err.number > 0 _
> [19] Then ErrorExit "Cannot open " & sLogFile & vbLf & Err.Description
> [20] On Error Goto 0
> [21]
> [22] '-------------------------------------
> [23] 'Recursively scan the nominated folder
> [24] '-------------------------------------
> [25] iCount = 0
> [26] CheckFolder oFSO.GetFolder(sSource)
> [27] oLogFile.Close
> [28] MsgBox iCount & " inaccessible folder(s) found." & vbLf _
> [29] & "Check the file " & sLogFile & " for details."
> [30]
> [31] '---------------
> [32] 'Scan one folder
> [33] '---------------
> [34] Sub CheckFolder (oFldr)
> [35] On Error Resume Next
> [36] For Each oSubfolder In oFldr.Subfolders
> [37] If IsEmpty (oSubfolder) Then
> [38] oLogFile.WriteLine "***Error*** """ & sPath & """"
> [39] Err.Clear
> [40] iCount = iCount + 1
> [41] Else
> [42] sPath = oSubfolder.path
> [43] CheckFolder oSubfolder
> [44] End If
> [45] Next
> [46] End Sub
> [47]
> [48] Sub ErrorExit (msg)
> [49] MsgBox msg
> [50] WScript.Quit 1
> [51] End Sub
>
>
>
My System SpecsSystem Spec
Old 07-27-2009   #4 (permalink)
Pegasus [MVP]


 
 

Re: Folder size script

Did you find any inaccessible folders?

I suspect that the FSO object demands a higher level of access than Explorer
does. Perhaps there is some WMI function that is less demanding. What do you
get against the "dir" console command? If it works then you could invoke it
from your script?


"mcgo****m" <mcgo****m@xxxxxx> wrote in message
news:C91EAF01-70EA-4802-A288-C1AEAEFAD0C1@xxxxxx
Quote:

> Thanks. I can see the problems I still dont' understand why when I click
> on
> the folder in Windows Explorer and check properties it gives me the size
> of
> the folder. Is there no way to ge the same result in a script?
>
> "Pegasus [MVP]" wrote:
>
Quote:

>>
>> "mcgo****m" <mcgo****m@xxxxxx> wrote in message
>> news:04D1D110-F791-47BE-96E5-1E5A72FDF10F@xxxxxx
Quote:

>> > I'm running a vbs script that gets the size of folders on another
>> > server.
>> > The basics of the script is:
>> >
>> > Set objFSO = CreateObject("Scripting.FileSystemObject")
>> > Set objFolder = objFSO.GetFolder("\\cet-vcl-021\xxxx$\Profiles")
>> >
>> > I can get most folders but not profile folders. I get the error
>> > "foldersize.vbs(3, 1) Microsoft VBScript runtime error: Permission
>> > denied"
>> > I
>> > am running the script with a domain admin account. I can go into
>> > properties
>> > for the folder and get the info I need why not by script?
>> >
>> > Thanks,
>> > Kevin
>> >
>>
>> I tested your script on my machine, replacing "Profiles" with "Documents
>> and
>> Settings". It worked perfectly. This makes me suspect that you have a
>> folder
>> inside the Profiles folder that is hidden and inaccessible to you, even
>> as a
>> domain admin. Since it's hidden, you may not be aware of its existence
>> but
>> it will trip up your script.
>>
>> A few weeks ago I wrote a script for someone who wanted a list of all
>> inaccessible folders. You could use it to confirm if my suspicion is
>> correct - see below.
>> [01] '---------------------------
>> [02] 'Locate inaccessible folders
>> [03] '22.6.2009 FNL
>> [04] '---------------------------
>> [05] sSource = "\\cet-vcl-021\xxxx$\Profiles"
>> [06] sLogFile = "d:\Inaccessible.txt"
>> [07] Dim sPath, iCount, oFSO
>> [08] Set oFSO = CreateObject("Scripting.FileSystemObject")
>> [09]
>> [10] '-----------------------
>> [11] 'Check script parameters
>> [12] '-----------------------
>> [13] If Not oFSO.FolderExists(sSource) _
>> [14] Then ErrorExit ("The folder " & sSource & " does not exist.")
>> [15]
>> [16] On Error Resume Next
>> [17] Set oLogFile = oFSO.CreateTextFile(sLogFile, True)
>> [18] If Err.number > 0 _
>> [19] Then ErrorExit "Cannot open " & sLogFile & vbLf & Err.Description
>> [20] On Error Goto 0
>> [21]
>> [22] '-------------------------------------
>> [23] 'Recursively scan the nominated folder
>> [24] '-------------------------------------
>> [25] iCount = 0
>> [26] CheckFolder oFSO.GetFolder(sSource)
>> [27] oLogFile.Close
>> [28] MsgBox iCount & " inaccessible folder(s) found." & vbLf _
>> [29] & "Check the file " & sLogFile & " for details."
>> [30]
>> [31] '---------------
>> [32] 'Scan one folder
>> [33] '---------------
>> [34] Sub CheckFolder (oFldr)
>> [35] On Error Resume Next
>> [36] For Each oSubfolder In oFldr.Subfolders
>> [37] If IsEmpty (oSubfolder) Then
>> [38] oLogFile.WriteLine "***Error*** """ & sPath & """"
>> [39] Err.Clear
>> [40] iCount = iCount + 1
>> [41] Else
>> [42] sPath = oSubfolder.path
>> [43] CheckFolder oSubfolder
>> [44] End If
>> [45] Next
>> [46] End Sub
>> [47]
>> [48] Sub ErrorExit (msg)
>> [49] MsgBox msg
>> [50] WScript.Quit 1
>> [51] End Sub
>>
>>
>>

My System SpecsSystem Spec
Old 07-27-2009   #5 (permalink)
mcgowankm


 
 

Re: Folder size script

I'm a rookie at this, not sure how to use that.

"Pegasus [MVP]" wrote:
Quote:

> Did you find any inaccessible folders?
>
> I suspect that the FSO object demands a higher level of access than Explorer
> does. Perhaps there is some WMI function that is less demanding. What do you
> get against the "dir" console command? If it works then you could invoke it
> from your script?
>
>
> "mcgo****m" <mcgo****m@xxxxxx> wrote in message
> news:C91EAF01-70EA-4802-A288-C1AEAEFAD0C1@xxxxxx
Quote:

> > Thanks. I can see the problems I still dont' understand why when I click
> > on
> > the folder in Windows Explorer and check properties it gives me the size
> > of
> > the folder. Is there no way to ge the same result in a script?
> >
> > "Pegasus [MVP]" wrote:
> >
Quote:

> >>
> >> "mcgo****m" <mcgo****m@xxxxxx> wrote in message
> >> news:04D1D110-F791-47BE-96E5-1E5A72FDF10F@xxxxxx
> >> > I'm running a vbs script that gets the size of folders on another
> >> > server.
> >> > The basics of the script is:
> >> >
> >> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> >> > Set objFolder = objFSO.GetFolder("\\cet-vcl-021\xxxx$\Profiles")
> >> >
> >> > I can get most folders but not profile folders. I get the error
> >> > "foldersize.vbs(3, 1) Microsoft VBScript runtime error: Permission
> >> > denied"
> >> > I
> >> > am running the script with a domain admin account. I can go into
> >> > properties
> >> > for the folder and get the info I need why not by script?
> >> >
> >> > Thanks,
> >> > Kevin
> >> >
> >>
> >> I tested your script on my machine, replacing "Profiles" with "Documents
> >> and
> >> Settings". It worked perfectly. This makes me suspect that you have a
> >> folder
> >> inside the Profiles folder that is hidden and inaccessible to you, even
> >> as a
> >> domain admin. Since it's hidden, you may not be aware of its existence
> >> but
> >> it will trip up your script.
> >>
> >> A few weeks ago I wrote a script for someone who wanted a list of all
> >> inaccessible folders. You could use it to confirm if my suspicion is
> >> correct - see below.
> >> [01] '---------------------------
> >> [02] 'Locate inaccessible folders
> >> [03] '22.6.2009 FNL
> >> [04] '---------------------------
> >> [05] sSource = "\\cet-vcl-021\xxxx$\Profiles"
> >> [06] sLogFile = "d:\Inaccessible.txt"
> >> [07] Dim sPath, iCount, oFSO
> >> [08] Set oFSO = CreateObject("Scripting.FileSystemObject")
> >> [09]
> >> [10] '-----------------------
> >> [11] 'Check script parameters
> >> [12] '-----------------------
> >> [13] If Not oFSO.FolderExists(sSource) _
> >> [14] Then ErrorExit ("The folder " & sSource & " does not exist.")
> >> [15]
> >> [16] On Error Resume Next
> >> [17] Set oLogFile = oFSO.CreateTextFile(sLogFile, True)
> >> [18] If Err.number > 0 _
> >> [19] Then ErrorExit "Cannot open " & sLogFile & vbLf & Err.Description
> >> [20] On Error Goto 0
> >> [21]
> >> [22] '-------------------------------------
> >> [23] 'Recursively scan the nominated folder
> >> [24] '-------------------------------------
> >> [25] iCount = 0
> >> [26] CheckFolder oFSO.GetFolder(sSource)
> >> [27] oLogFile.Close
> >> [28] MsgBox iCount & " inaccessible folder(s) found." & vbLf _
> >> [29] & "Check the file " & sLogFile & " for details."
> >> [30]
> >> [31] '---------------
> >> [32] 'Scan one folder
> >> [33] '---------------
> >> [34] Sub CheckFolder (oFldr)
> >> [35] On Error Resume Next
> >> [36] For Each oSubfolder In oFldr.Subfolders
> >> [37] If IsEmpty (oSubfolder) Then
> >> [38] oLogFile.WriteLine "***Error*** """ & sPath & """"
> >> [39] Err.Clear
> >> [40] iCount = iCount + 1
> >> [41] Else
> >> [42] sPath = oSubfolder.path
> >> [43] CheckFolder oSubfolder
> >> [44] End If
> >> [45] Next
> >> [46] End Sub
> >> [47]
> >> [48] Sub ErrorExit (msg)
> >> [49] MsgBox msg
> >> [50] WScript.Quit 1
> >> [51] End Sub
> >>
> >>
> >>
>
>
>
My System SpecsSystem Spec
Old 07-27-2009   #6 (permalink)
Pegasus [MVP]


 
 

Re: Folder size script

If you are a beginner then you need to follow instructions. I posted a
complete script to identify inaccessible folders. Run it so that you can
find out what's going on!

About the "dir" command: Run it to see what it reports. If unsure how to do
this, here is the long-hand recipe:
- Click Start, then Run.
- Type the three letters cmd
- Click the OK button.
- Type the following command:
dir /s "\\cet-vcl-021\xxxx$\Profiles" | find /i "file(s)"
- Press the Enter key.
- Make a note of the last line you see.
dir /s /ah "\\cet-vcl-021\xxxx$\Profiles" | find /i "file(s)"
- Press the Enter key.
- Make a note of the last line you see.
- Add up the two results.
- Compare the result against what Windows Explorer reports.

"mcgo****m" <mcgo****m@xxxxxx> wrote in message
news:B0740FCF-6376-4B79-95AD-BBA68AB1B4A1@xxxxxx
Quote:

> I'm a rookie at this, not sure how to use that.
>
> "Pegasus [MVP]" wrote:
>
Quote:

>> Did you find any inaccessible folders?
>>
>> I suspect that the FSO object demands a higher level of access than
>> Explorer
>> does. Perhaps there is some WMI function that is less demanding. What do
>> you
>> get against the "dir" console command? If it works then you could invoke
>> it
>> from your script?
>>
>>
>> "mcgo****m" <mcgo****m@xxxxxx> wrote in message
>> news:C91EAF01-70EA-4802-A288-C1AEAEFAD0C1@xxxxxx
Quote:

>> > Thanks. I can see the problems I still dont' understand why when I
>> > click
>> > on
>> > the folder in Windows Explorer and check properties it gives me the
>> > size
>> > of
>> > the folder. Is there no way to ge the same result in a script?
>> >
>> > "Pegasus [MVP]" wrote:
>> >
>> >>
>> >> "mcgo****m" <mcgo****m@xxxxxx> wrote in message
>> >> news:04D1D110-F791-47BE-96E5-1E5A72FDF10F@xxxxxx
>> >> > I'm running a vbs script that gets the size of folders on another
>> >> > server.
>> >> > The basics of the script is:
>> >> >
>> >> > Set objFSO = CreateObject("Scripting.FileSystemObject")
>> >> > Set objFolder = objFSO.GetFolder("\\cet-vcl-021\xxxx$\Profiles")
>> >> >
>> >> > I can get most folders but not profile folders. I get the error
>> >> > "foldersize.vbs(3, 1) Microsoft VBScript runtime error: Permission
>> >> > denied"
>> >> > I
>> >> > am running the script with a domain admin account. I can go into
>> >> > properties
>> >> > for the folder and get the info I need why not by script?
>> >> >
>> >> > Thanks,
>> >> > Kevin
>> >> >
>> >>
>> >> I tested your script on my machine, replacing "Profiles" with
>> >> "Documents
>> >> and
>> >> Settings". It worked perfectly. This makes me suspect that you have a
>> >> folder
>> >> inside the Profiles folder that is hidden and inaccessible to you,
>> >> even
>> >> as a
>> >> domain admin. Since it's hidden, you may not be aware of its existence
>> >> but
>> >> it will trip up your script.
>> >>
>> >> A few weeks ago I wrote a script for someone who wanted a list of all
>> >> inaccessible folders. You could use it to confirm if my suspicion is
>> >> correct - see below.
>> >> [01] '---------------------------
>> >> [02] 'Locate inaccessible folders
>> >> [03] '22.6.2009 FNL
>> >> [04] '---------------------------
>> >> [05] sSource = "\\cet-vcl-021\xxxx$\Profiles"
>> >> [06] sLogFile = "d:\Inaccessible.txt"
>> >> [07] Dim sPath, iCount, oFSO
>> >> [08] Set oFSO = CreateObject("Scripting.FileSystemObject")
>> >> [09]
>> >> [10] '-----------------------
>> >> [11] 'Check script parameters
>> >> [12] '-----------------------
>> >> [13] If Not oFSO.FolderExists(sSource) _
>> >> [14] Then ErrorExit ("The folder " & sSource & " does not exist.")
>> >> [15]
>> >> [16] On Error Resume Next
>> >> [17] Set oLogFile = oFSO.CreateTextFile(sLogFile, True)
>> >> [18] If Err.number > 0 _
>> >> [19] Then ErrorExit "Cannot open " & sLogFile & vbLf & Err.Description
>> >> [20] On Error Goto 0
>> >> [21]
>> >> [22] '-------------------------------------
>> >> [23] 'Recursively scan the nominated folder
>> >> [24] '-------------------------------------
>> >> [25] iCount = 0
>> >> [26] CheckFolder oFSO.GetFolder(sSource)
>> >> [27] oLogFile.Close
>> >> [28] MsgBox iCount & " inaccessible folder(s) found." & vbLf _
>> >> [29] & "Check the file " & sLogFile & " for details."
>> >> [30]
>> >> [31] '---------------
>> >> [32] 'Scan one folder
>> >> [33] '---------------
>> >> [34] Sub CheckFolder (oFldr)
>> >> [35] On Error Resume Next
>> >> [36] For Each oSubfolder In oFldr.Subfolders
>> >> [37] If IsEmpty (oSubfolder) Then
>> >> [38] oLogFile.WriteLine "***Error*** """ & sPath & """"
>> >> [39] Err.Clear
>> >> [40] iCount = iCount + 1
>> >> [41] Else
>> >> [42] sPath = oSubfolder.path
>> >> [43] CheckFolder oSubfolder
>> >> [44] End If
>> >> [45] Next
>> >> [46] End Sub
>> >> [47]
>> >> [48] Sub ErrorExit (msg)
>> >> [49] MsgBox msg
>> >> [50] WScript.Quit 1
>> >> [51] End Sub
>> >>
>> >>
>> >>
>>
>>
>>

My System SpecsSystem Spec
Old 07-27-2009   #7 (permalink)
Al Dunbar


 
 

Re: Folder size script

"Pegasus [MVP]" <news@xxxxxx> wrote in message
news:#0rzkrsDKHA.5956@xxxxxx
Quote:

> Did you find any inaccessible folders?
>
> I suspect that the FSO object demands a higher level of access than
> Explorer does.
Not so. Both operate under the credentials of the current user and both will
give exactly the same result: the aggregate size of all files visible to the
user within the folder. The difference being that explorer doesn't pass the
error along to the user - and thank goodness for that.

A script would have to trap the access denied error to prevent its being
displayed (if that is what is desired).
Quote:

> Perhaps there is some WMI function that is less demanding. What do you
> get against the "dir" console command? If it works then you could invoke
> it from your script?
DIR /a/s gives exactly the same result. Try DIR/a/s on the "C:\documents and
settings" folder you are logged into as a non-admin. Then look at the file
count in the file properties shown by windows explorer. Then determine how
many files exist in all the folders you do have access to. When I did this,
it added up to exactly the same number as given by DIR/a/s and windows
explorer.

If it is desired to find the ACTUAL aggregate size of ALL files in a folder,
this can only be done using an account having sufficient access to see all
of the files. How could this be otherwise.

But, back to the OP's original question. All domain admin accounts should be
members of the local "administrators" group on all member computers. But
some organizations block admin access to home folders and profiles. Is that
perhaps the case in your situation?

/Al
Quote:

>
>
> "mcgo****m" <mcgo****m@xxxxxx> wrote in message
> news:C91EAF01-70EA-4802-A288-C1AEAEFAD0C1@xxxxxx
Quote:

>> Thanks. I can see the problems I still dont' understand why when I click
>> on
>> the folder in Windows Explorer and check properties it gives me the size
>> of
>> the folder. Is there no way to ge the same result in a script?
>>
>> "Pegasus [MVP]" wrote:
>>
Quote:

>>>
>>> "mcgo****m" <mcgo****m@xxxxxx> wrote in message
>>> news:04D1D110-F791-47BE-96E5-1E5A72FDF10F@xxxxxx
>>> > I'm running a vbs script that gets the size of folders on another
>>> > server.
>>> > The basics of the script is:
>>> >
>>> > Set objFSO = CreateObject("Scripting.FileSystemObject")
>>> > Set objFolder = objFSO.GetFolder("\\cet-vcl-021\xxxx$\Profiles")
>>> >
>>> > I can get most folders but not profile folders. I get the error
>>> > "foldersize.vbs(3, 1) Microsoft VBScript runtime error: Permission
>>> > denied"
>>> > I
>>> > am running the script with a domain admin account. I can go into
>>> > properties
>>> > for the folder and get the info I need why not by script?
>>> >
>>> > Thanks,
>>> > Kevin
>>> >
>>>
>>> I tested your script on my machine, replacing "Profiles" with "Documents
>>> and
>>> Settings". It worked perfectly. This makes me suspect that you have a
>>> folder
>>> inside the Profiles folder that is hidden and inaccessible to you, even
>>> as a
>>> domain admin. Since it's hidden, you may not be aware of its existence
>>> but
>>> it will trip up your script.
>>>
>>> A few weeks ago I wrote a script for someone who wanted a list of all
>>> inaccessible folders. You could use it to confirm if my suspicion is
>>> correct - see below.
>>> [01] '---------------------------
>>> [02] 'Locate inaccessible folders
>>> [03] '22.6.2009 FNL
>>> [04] '---------------------------
>>> [05] sSource = "\\cet-vcl-021\xxxx$\Profiles"
>>> [06] sLogFile = "d:\Inaccessible.txt"
>>> [07] Dim sPath, iCount, oFSO
>>> [08] Set oFSO = CreateObject("Scripting.FileSystemObject")
>>> [09]
>>> [10] '-----------------------
>>> [11] 'Check script parameters
>>> [12] '-----------------------
>>> [13] If Not oFSO.FolderExists(sSource) _
>>> [14] Then ErrorExit ("The folder " & sSource & " does not exist.")
>>> [15]
>>> [16] On Error Resume Next
>>> [17] Set oLogFile = oFSO.CreateTextFile(sLogFile, True)
>>> [18] If Err.number > 0 _
>>> [19] Then ErrorExit "Cannot open " & sLogFile & vbLf & Err.Description
>>> [20] On Error Goto 0
>>> [21]
>>> [22] '-------------------------------------
>>> [23] 'Recursively scan the nominated folder
>>> [24] '-------------------------------------
>>> [25] iCount = 0
>>> [26] CheckFolder oFSO.GetFolder(sSource)
>>> [27] oLogFile.Close
>>> [28] MsgBox iCount & " inaccessible folder(s) found." & vbLf _
>>> [29] & "Check the file " & sLogFile & " for details."
>>> [30]
>>> [31] '---------------
>>> [32] 'Scan one folder
>>> [33] '---------------
>>> [34] Sub CheckFolder (oFldr)
>>> [35] On Error Resume Next
>>> [36] For Each oSubfolder In oFldr.Subfolders
>>> [37] If IsEmpty (oSubfolder) Then
>>> [38] oLogFile.WriteLine "***Error*** """ & sPath & """"
>>> [39] Err.Clear
>>> [40] iCount = iCount + 1
>>> [41] Else
>>> [42] sPath = oSubfolder.path
>>> [43] CheckFolder oSubfolder
>>> [44] End If
>>> [45] Next
>>> [46] End Sub
>>> [47]
>>> [48] Sub ErrorExit (msg)
>>> [49] MsgBox msg
>>> [50] WScript.Quit 1
>>> [51] End Sub
>>>
>>>
>>>
>
>


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Script to Find Size of a Certain Folder on All Users in an Org PowerShell
Re: Help required with file size checking script VB Script
Folder size script returns value of zero for some folders PowerShell
Re: VB Script Code to get alert when a folder get changed in intranet FTP Folder VB Script
Folder Size in Size Column Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

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