Forum Search:
Forum.Brain-Cluster.com: Brain Cluster Technical Forum
Ultimate forum for Technical Discussions

Home » Microsoft » Windows Server » Windows Server General Help » List of which folders I don't have permission to as an admin
List of which folders I don't have permission to as an admin [message #164294] Fri, 19 June 2009 11:33 Go to next message
Rich  is currently offline Rich
Messages: 178
Registered: July 2009
Senior Member
Does anyone know of any easy way to tell which folders on a drive I don't
have permission to? I'm an admin on the server, but have a HUGE Users share
with thousands of subfolders, and it appears buried within somewhere there
are some folders I do not have permission to. Would like to know which ones
they are so i can manually fix them. I can't do a blanket reset permissions
on the root folder since each user folder underneath Users has individual
folders for each user with only them and admins having permission to it.
Re: List of which folders I don't have permission to as an admin [message #164296 is a reply to message #164294] Fri, 19 June 2009 13:42 Go to previous messageGo to next message
techstress  is currently offline techstress  United States
Messages: 23
Registered: July 2009
Junior Member
open the root in command line

run dir * /s > out.txt

search through the text file for access denied.


On Jun 19, 11:33 am, Rich <richj...@noemail.noemail> wrote:
> Does anyone know of any easy way to tell which folders on a drive I don't
> have permission to?  I'm an admin on the server, but have a HUGE Users share
> with thousands of subfolders, and it appears buried within somewhere there
> are some folders I do not have permission to.  Would like to know which ones
> they are so i can manually fix them.  I can't do a blanket reset permissions
> on the root folder since each user folder underneath Users has individual
> folders for each user with only them and admins having permission to it.
Re: List of which folders I don't have permission to as an admin [message #164300 is a reply to message #164294] Fri, 19 June 2009 14:22 Go to previous messageGo to next message
lanwench  is currently offline lanwench  United States
Messages: 1684
Registered: July 2009
Senior Member
Rich <richjone@noemail.noemail> wrote:
> Does anyone know of any easy way to tell which folders on a drive I
> don't have permission to? I'm an admin on the server, but have a
> HUGE Users share with thousands of subfolders, and it appears buried
> within somewhere there are some folders I do not have permission to.
> Would like to know which ones they are so i can manually fix them. I
> can't do a blanket reset permissions on the root folder since each
> user folder underneath Users has individual folders for each user
> with only them and admins having permission to it.

I doubt it, but why bother? If these are home directories (e.g., each user
has a folder and the subfolders don't have anything funky like other users'
permissions in them), and you're very careful, you can take ownership as
Administrators (the group) and add Administrator (the user) with full
control, without disturbing the existing permissions. Check out xcacls /
xcacls.vbs - there's also a nice GUI for that I found a while back, but I
don't remember where. google should turn it up easily.
Re: List of which folders I don't have permission to as an admin [message #164309 is a reply to message #164294] Fri, 19 June 2009 14:37 Go to previous messageGo to next message
news  is currently offline news  Switzerland
Messages: 2294
Registered: July 2009
Senior Member
"Rich" <richjone@noemail.noemail> wrote in message
news:62B870A2-8893-48DB-9281-D0FA747A9150@microsoft.com...
> Does anyone know of any easy way to tell which folders on a drive I don't
> have permission to? I'm an admin on the server, but have a HUGE Users
> share
> with thousands of subfolders, and it appears buried within somewhere there
> are some folders I do not have permission to. Would like to know which
> ones
> they are so i can manually fix them. I can't do a blanket reset
> permissions
> on the root folder since each user folder underneath Users has individual
> folders for each user with only them and admins having permission to it.

Run the batch file below. It will give you a list of all folders, with
inaccessible folders suitably marked.

@echo off
set Folder=d:\User Files
set Scr=c:\TempVBS.vbs
set VB=echo^>^>%Scr%
cd 1>nul 2>%Scr%
%VB% Set oFSO = CreateObject("Scripting.FileSystemObject")
%VB% CheckFolder oFSO.GetFolder("%Folder%")
%VB% Sub CheckFolder (oFldr)
%VB% On Error Resume Next
%VB% For Each oSubfolder In oFldr.Subfolders
%VB% WScript.echo oSubfolder.path
%VB% If Err.number ^> 0 Then
%VB% WScript.echo "***Error***"
%VB% Else CheckFolder oSubfolder
%VB% End If
%VB% Err.clear
%VB% Next
%VB% End Sub
echo The folder above the message ***Error*** is inaccessible. >
c:\folders.txt
echo Processing the folder %Folder% recursively. Please wait.
cscript //nologo %Scr% >> c:\folders.txt
del %Scr%
notepad c:folders.txt
Re: List of which folders I don't have permission to as an admin [message #164312 is a reply to message #164309] Fri, 19 June 2009 16:14 Go to previous messageGo to next message
news  is currently offline news  Switzerland
Messages: 2294
Registered: July 2009
Senior Member
"Rich" <richjone@noemail.noemail> wrote in message
news:C3ADA7D9-DD1C-4603-BC6A-8614F3EA8C1B@microsoft.com...
> That worked perfectly, many thanks!

Thanks for the feedback.
Re: List of which folders I don't have permission to as an admin [message #164316 is a reply to message #164309] Fri, 19 June 2009 16:00 Go to previous messageGo to next message
Rich  is currently offline Rich
Messages: 178
Registered: July 2009
Senior Member
That worked perfectly, many thanks!

"Pegasus [MVP]" wrote:

>
> "Rich" <richjone@noemail.noemail> wrote in message
> news:62B870A2-8893-48DB-9281-D0FA747A9150@microsoft.com...
> > Does anyone know of any easy way to tell which folders on a drive I don't
> > have permission to? I'm an admin on the server, but have a HUGE Users
> > share
> > with thousands of subfolders, and it appears buried within somewhere there
> > are some folders I do not have permission to. Would like to know which
> > ones
> > they are so i can manually fix them. I can't do a blanket reset
> > permissions
> > on the root folder since each user folder underneath Users has individual
> > folders for each user with only them and admins having permission to it.
>
> Run the batch file below. It will give you a list of all folders, with
> inaccessible folders suitably marked.
>
> @echo off
> set Folder=d:\User Files
> set Scr=c:\TempVBS.vbs
> set VB=echo^>^>%Scr%
> cd 1>nul 2>%Scr%
> %VB% Set oFSO = CreateObject("Scripting.FileSystemObject")
> %VB% CheckFolder oFSO.GetFolder("%Folder%")
> %VB% Sub CheckFolder (oFldr)
> %VB% On Error Resume Next
> %VB% For Each oSubfolder In oFldr.Subfolders
> %VB% WScript.echo oSubfolder.path
> %VB% If Err.number ^> 0 Then
> %VB% WScript.echo "***Error***"
> %VB% Else CheckFolder oSubfolder
> %VB% End If
> %VB% Err.clear
> %VB% Next
> %VB% End Sub
> echo The folder above the message ***Error*** is inaccessible. >
> c:\folders.txt
> echo Processing the folder %Folder% recursively. Please wait.
> cscript //nologo %Scr% >> c:\folders.txt
> del %Scr%
> notepad c:folders.txt
>
>
>
Re: List of which folders I don't have permission to as an admin [message #164351 is a reply to message #164312] Sun, 21 June 2009 09:21 Go to previous messageGo to next message
lanwench  is currently offline lanwench  United States
Messages: 1684
Registered: July 2009
Senior Member
Pegasus [MVP] <news@microsoft.com> wrote:
> "Rich" <richjone@noemail.noemail> wrote in message
> news:C3ADA7D9-DD1C-4603-BC6A-8614F3EA8C1B@microsoft.com...
>> That worked perfectly, many thanks!
>
> Thanks for the feedback.

Hey, Pegasus - thanks for this. I was intrigued. However, it doesn't run for
me. No errors. Anything special I have to do? Was testing on my XP Pro
workstation on a local drive, but would think that would still work, right?
Re: List of which folders I don't have permission to as an admin [message #164358 is a reply to message #164351] Sun, 21 June 2009 13:44 Go to previous messageGo to next message
news  is currently offline news  Switzerland
Messages: 2294
Registered: July 2009
Senior Member
"Lanwench [MVP - Exchange]"
<lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in message
news:ejnCrMn8JHA.2788@TK2MSFTNGP05.phx.gbl...
> Pegasus [MVP] <news@microsoft.com> wrote:
>> "Rich" <richjone@noemail.noemail> wrote in message
>> news:C3ADA7D9-DD1C-4603-BC6A-8614F3EA8C1B@microsoft.com...
>>> That worked perfectly, many thanks!
>>
>> Thanks for the feedback.
>
> Hey, Pegasus - thanks for this. I was intrigued. However, it doesn't run
> for me. No errors. Anything special I have to do? Was testing on my XP Pro
> workstation on a local drive, but would think that would still work,
> right?

I didn't think there would be anything I could intrigue you with . . . I
tested the code on a WinXP Pro machine and it works fine. Perhaps you don't
have any inaccessible folders? The "System Volume Information" folder is by
default inaccessible, even to administrators.

Try the VB Script below. I left it in its original form [other than adding
line numbers] so that you can modify it more easily. I also improved it a
little: By removing line [15] you can focus on the inaccessible folder
names, without getting distracted by the many other folder names.

[01] Const sSource = "d:\User Files"
[02] Dim sPath
[03]
[04] Set oFSO = CreateObject("Scripting.FileSystemObject")
[05] CheckFolder oFSO.GetFolder(sSource)
[06]
[07] Sub CheckFolder (oFldr)
[08] On Error Resume Next
[09] For Each oSubfolder In oFldr.Subfolders
[10] If IsEmpty (oSubfolder) Then
[11] WScript.echo "***Error*** """ & sPath & """"
[12] Err.Clear
[13] Else
[14] sPath = oSubfolder.path
[15] WScript.Echo "Processing """ & sPath & """"
[16] CheckFolder oSubfolder
[17] End If
[18] Next
[19] End Sub
Re: List of which folders I don't have permission to as an admin [message #164360 is a reply to message #164358] Sun, 21 June 2009 14:52 Go to previous messageGo to next message
news  is currently offline news  Switzerland
Messages: 2294
Registered: July 2009
Senior Member
"Lanwench [MVP - Exchange]"
<lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in message
news:%23w47s2p8JHA.1376@TK2MSFTNGP02.phx.gbl...
> Pegasus [MVP] <news@microsoft.com> wrote:
>> "Lanwench [MVP - Exchange]"
>> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
>> message news:ejnCrMn8JHA.2788@TK2MSFTNGP05.phx.gbl...
>>> Pegasus [MVP] <news@microsoft.com> wrote:
>>>> "Rich" <richjone@noemail.noemail> wrote in message
>>>> news:C3ADA7D9-DD1C-4603-BC6A-8614F3EA8C1B@microsoft.com...
>>>>> That worked perfectly, many thanks!
>>>>
>>>> Thanks for the feedback.
>>>
>>> Hey, Pegasus - thanks for this. I was intrigued. However, it doesn't
>>> run for me. No errors. Anything special I have to do? Was testing on
>>> my XP Pro workstation on a local drive, but would think that would
>>> still work, right?
>>
>> I didn't think there would be anything I could intrigue you with . .
>
> <snort> Are you kidding? You probably don't know how often I follow you
> around in Usenet like an infatuated puppy :-)
>
>> . I tested the code on a WinXP Pro machine and it works fine. Perhaps
>> you don't have any inaccessible folders?
>
> I'm sure that's true; I'm a local admin on this PC (the cobbler's children
> go barefoot). I guess I was expecting it to log something anyway, but it
> just opened 'n closed without a peep.
>
> The "System Volume
>> Information" folder is by default inaccessible, even to
>> administrators.
>> Try the VB Script below. I left it in its original form [other than
>> adding line numbers] so that you can modify it more easily. I also
>> improved it a little: By removing line [15] you can focus on the
>> inaccessible folder names, without getting distracted by the many
>> other folder names.
>> [01] Const sSource = "d:\User Files"
>> [02] Dim sPath
>> [03]
>> [04] Set oFSO = CreateObject("Scripting.FileSystemObject")
>> [05] CheckFolder oFSO.GetFolder(sSource)
>> [06]
>> [07] Sub CheckFolder (oFldr)
>> [08] On Error Resume Next
>> [09] For Each oSubfolder In oFldr.Subfolders
>> [10] If IsEmpty (oSubfolder) Then
>> [11] WScript.echo "***Error*** """ & sPath & """"
>> [12] Err.Clear
>> [13] Else
>> [14] sPath = oSubfolder.path
>> [15] WScript.Echo "Processing """ & sPath & """"
>> [16] CheckFolder oSubfolder
>> [17] End If
>> [18] Next
>> [19] End Sub
>
> I'm getting a WHS error....
> Script <path & filename>
> Line: 1
> Char: 6
> Error: Syntax error
> Code: 800A03EA
> Source: Microsoft VBScript compliation error
>
> I'm not a VB person so I'm not sure what it's fussing about (or where to
> start counting characters in line 1). I created a new notepad file, copied
> and pasted in your text above, replaced "d"\user files" with "c:" and
> saved it to my desktop with a .vbs extension.
>
> This could be really nice if I can get it working!

Did you remove the [xx] bit at the start of each line?
You should invoke the script from a Command Prompt (not from the Run box)
like so:
cscript //nologo c:\perms.vbs
Re: List of which folders I don't have permission to as an admin [message #164362 is a reply to message #164358] Sun, 21 June 2009 14:25 Go to previous messageGo to next message
lanwench  is currently offline lanwench  United States
Messages: 1684
Registered: July 2009
Senior Member
Pegasus [MVP] <news@microsoft.com> wrote:
> "Lanwench [MVP - Exchange]"
> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
> message news:ejnCrMn8JHA.2788@TK2MSFTNGP05.phx.gbl...
>> Pegasus [MVP] <news@microsoft.com> wrote:
>>> "Rich" <richjone@noemail.noemail> wrote in message
>>> news:C3ADA7D9-DD1C-4603-BC6A-8614F3EA8C1B@microsoft.com...
>>>> That worked perfectly, many thanks!
>>>
>>> Thanks for the feedback.
>>
>> Hey, Pegasus - thanks for this. I was intrigued. However, it doesn't
>> run for me. No errors. Anything special I have to do? Was testing on
>> my XP Pro workstation on a local drive, but would think that would
>> still work, right?
>
> I didn't think there would be anything I could intrigue you with . .

<snort> Are you kidding? You probably don't know how often I follow you
around in Usenet like an infatuated puppy :-)

> . I tested the code on a WinXP Pro machine and it works fine. Perhaps
> you don't have any inaccessible folders?

I'm sure that's true; I'm a local admin on this PC (the cobbler's children
go barefoot). I guess I was expecting it to log something anyway, but it
just opened 'n closed without a peep.

The "System Volume
> Information" folder is by default inaccessible, even to
> administrators.
> Try the VB Script below. I left it in its original form [other than
> adding line numbers] so that you can modify it more easily. I also
> improved it a little: By removing line [15] you can focus on the
> inaccessible folder names, without getting distracted by the many
> other folder names.
> [01] Const sSource = "d:\User Files"
> [02] Dim sPath
> [03]
> [04] Set oFSO = CreateObject("Scripting.FileSystemObject")
> [05] CheckFolder oFSO.GetFolder(sSource)
> [06]
> [07] Sub CheckFolder (oFldr)
> [08] On Error Resume Next
> [09] For Each oSubfolder In oFldr.Subfolders
> [10] If IsEmpty (oSubfolder) Then
> [11] WScript.echo "***Error*** """ & sPath & """"
> [12] Err.Clear
> [13] Else
> [14] sPath = oSubfolder.path
> [15] WScript.Echo "Processing """ & sPath & """"
> [16] CheckFolder oSubfolder
> [17] End If
> [18] Next
> [19] End Sub

I'm getting a WHS error....
Script <path & filename>
Line: 1
Char: 6
Error: Syntax error
Code: 800A03EA
Source: Microsoft VBScript compliation error

I'm not a VB person so I'm not sure what it's fussing about (or where to
start counting characters in line 1). I created a new notepad file, copied
and pasted in your text above, replaced "d"\user files" with "c:" and saved
it to my desktop with a .vbs extension.

This could be really nice if I can get it working!
Re: List of which folders I don't have permission to as an admin [message #164366 is a reply to message #164360] Sun, 21 June 2009 18:53 Go to previous messageGo to next message
lanwench  is currently offline lanwench  United States
Messages: 1684
Registered: July 2009
Senior Member
Pegasus [MVP] <news@microsoft.com> wrote:
> "Lanwench [MVP - Exchange]"
> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
> message news:%23w47s2p8JHA.1376@TK2MSFTNGP02.phx.gbl...
>> Pegasus [MVP] <news@microsoft.com> wrote:
>>> "Lanwench [MVP - Exchange]"
>>> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
>>> message news:ejnCrMn8JHA.2788@TK2MSFTNGP05.phx.gbl...
>>>> Pegasus [MVP] <news@microsoft.com> wrote:
>>>>> "Rich" <richjone@noemail.noemail> wrote in message
>>>>> news:C3ADA7D9-DD1C-4603-BC6A-8614F3EA8C1B@microsoft.com...
>>>>>> That worked perfectly, many thanks!
>>>>>
>>>>> Thanks for the feedback.
>>>>
>>>> Hey, Pegasus - thanks for this. I was intrigued. However, it
>>>> doesn't run for me. No errors. Anything special I have to do? Was
>>>> testing on my XP Pro workstation on a local drive, but would think
>>>> that would still work, right?
>>>
>>> I didn't think there would be anything I could intrigue you with . .
>>
>> <snort> Are you kidding? You probably don't know how often I follow
>> you around in Usenet like an infatuated puppy :-)
>>
>>> . I tested the code on a WinXP Pro machine and it works fine.
>>> Perhaps you don't have any inaccessible folders?
>>
>> I'm sure that's true; I'm a local admin on this PC (the cobbler's
>> children go barefoot). I guess I was expecting it to log something
>> anyway, but it just opened 'n closed without a peep.
>>
>> The "System Volume
>>> Information" folder is by default inaccessible, even to
>>> administrators.
>>> Try the VB Script below. I left it in its original form [other than
>>> adding line numbers] so that you can modify it more easily. I also
>>> improved it a little: By removing line [15] you can focus on the
>>> inaccessible folder names, without getting distracted by the many
>>> other folder names.
>>> [01] Const sSource = "d:\User Files"
>>> [02] Dim sPath
>>> [03]
>>> [04] Set oFSO = CreateObject("Scripting.FileSystemObject")
>>> [05] CheckFolder oFSO.GetFolder(sSource)
>>> [06]
>>> [07] Sub CheckFolder (oFldr)
>>> [08] On Error Resume Next
>>> [09] For Each oSubfolder In oFldr.Subfolders
>>> [10] If IsEmpty (oSubfolder) Then
>>> [11] WScript.echo "***Error*** """ & sPath & """"
>>> [12] Err.Clear
>>> [13] Else
>>> [14] sPath = oSubfolder.path
>>> [15] WScript.Echo "Processing """ & sPath & """"
>>> [16] CheckFolder oSubfolder
>>> [17] End If
>>> [18] Next
>>> [19] End Sub
>>
>> I'm getting a WHS error....
>> Script <path & filename>
>> Line: 1
>> Char: 6
>> Error: Syntax error
>> Code: 800A03EA
>> Source: Microsoft VBScript compliation error
>>
>> I'm not a VB person so I'm not sure what it's fussing about (or
>> where to start counting characters in line 1). I created a new
>> notepad file, copied and pasted in your text above, replaced
>> "d"\user files" with "c:" and saved it to my desktop with a .vbs
>> extension. This could be really nice if I can get it working!
>
> Did you remove the [xx] bit at the start of each line?
> You should invoke the script from a Command Prompt (not from the Run
> box) like so:
> cscript //nologo c:\perms.vbs

LOL - I hadn't, but I have done now and it runs.
Now where does it output (put out??) other than within the command line? I
can't see any log, etc.
Re: List of which folders I don't have permission to as an admin [message #164371 is a reply to message #164366] Mon, 22 June 2009 01:25 Go to previous messageGo to next message
news  is currently offline news  Switzerland
Messages: 2294
Registered: July 2009
Senior Member
"Lanwench [MVP - Exchange]"
<lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in message
news:uyzRUMs8JHA.3916@TK2MSFTNGP02.phx.gbl...
> Pegasus [MVP] <news@microsoft.com> wrote:
>> "Lanwench [MVP - Exchange]"
>> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
>> message news:%23w47s2p8JHA.1376@TK2MSFTNGP02.phx.gbl...
>>> Pegasus [MVP] <news@microsoft.com> wrote:
>>>> "Lanwench [MVP - Exchange]"
>>>> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
>>>> message news:ejnCrMn8JHA.2788@TK2MSFTNGP05.phx.gbl...
>>>>> Pegasus [MVP] <news@microsoft.com> wrote:
>>>>>> "Rich" <richjone@noemail.noemail> wrote in message
>>>>>> news:C3ADA7D9-DD1C-4603-BC6A-8614F3EA8C1B@microsoft.com...
>>>>>>> That worked perfectly, many thanks!
>>>>>>
>>>>>> Thanks for the feedback.
>>>>>
>>>>> Hey, Pegasus - thanks for this. I was intrigued. However, it
>>>>> doesn't run for me. No errors. Anything special I have to do? Was
>>>>> testing on my XP Pro workstation on a local drive, but would think
>>>>> that would still work, right?
>>>>
>>>> I didn't think there would be anything I could intrigue you with . .
>>>
>>> <snort> Are you kidding? You probably don't know how often I follow
>>> you around in Usenet like an infatuated puppy :-)
>>>
>>>> . I tested the code on a WinXP Pro machine and it works fine.
>>>> Perhaps you don't have any inaccessible folders?
>>>
>>> I'm sure that's true; I'm a local admin on this PC (the cobbler's
>>> children go barefoot). I guess I was expecting it to log something
>>> anyway, but it just opened 'n closed without a peep.
>>>
>>> The "System Volume
>>>> Information" folder is by default inaccessible, even to
>>>> administrators.
>>>> Try the VB Script below. I left it in its original form [other than
>>>> adding line numbers] so that you can modify it more easily. I also
>>>> improved it a little: By removing line [15] you can focus on the
>>>> inaccessible folder names, without getting distracted by the many
>>>> other folder names.
>>>> [01] Const sSource = "d:\User Files"
>>>> [02] Dim sPath
>>>> [03]
>>>> [04] Set oFSO = CreateObject("Scripting.FileSystemObject")
>>>> [05] CheckFolder oFSO.GetFolder(sSource)
>>>> [06]
>>>> [07] Sub CheckFolder (oFldr)
>>>> [08] On Error Resume Next
>>>> [09] For Each oSubfolder In oFldr.Subfolders
>>>> [10] If IsEmpty (oSubfolder) Then
>>>> [11] WScript.echo "***Error*** """ & sPath & """"
>>>> [12] Err.Clear
>>>> [13] Else
>>>> [14] sPath = oSubfolder.path
>>>> [15] WScript.Echo "Processing """ & sPath & """"
>>>> [16] CheckFolder oSubfolder
>>>> [17] End If
>>>> [18] Next
>>>> [19] End Sub
>>>
>>> I'm getting a WHS error....
>>> Script <path & filename>
>>> Line: 1
>>> Char: 6
>>> Error: Syntax error
>>> Code: 800A03EA
>>> Source: Microsoft VBScript compliation error
>>>
>>> I'm not a VB person so I'm not sure what it's fussing about (or
>>> where to start counting characters in line 1). I created a new
>>> notepad file, copied and pasted in your text above, replaced
>>> "d"\user files" with "c:" and saved it to my desktop with a .vbs
>>> extension. This could be really nice if I can get it working!
>>
>> Did you remove the [xx] bit at the start of each line?
>> You should invoke the script from a Command Prompt (not from the Run
>> box) like so:
>> cscript //nologo c:\perms.vbs
>
> LOL - I hadn't, but I have done now and it runs.
> Now where does it output (put out??) other than within the command line? I
> can't see any log, etc.

In this version, output is written to the console. You could pick it up by
redirecting it into a file. If you intend to use the script often then I'd
be happy to modify it so that its outpput goes into some text file.
Re: List of which folders I don't have permission to as an admin [message #164389 is a reply to message #164371] Mon, 22 June 2009 10:04 Go to previous messageGo to next message
lanwench  is currently offline lanwench  United States
Messages: 1684
Registered: July 2009
Senior Member
Pegasus [MVP] <news@microsoft.com> wrote:
> "Lanwench [MVP - Exchange]"
> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
> message news:uyzRUMs8JHA.3916@TK2MSFTNGP02.phx.gbl...
>> Pegasus [MVP] <news@microsoft.com> wrote:
>>> "Lanwench [MVP - Exchange]"
>>> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
>>> message news:%23w47s2p8JHA.1376@TK2MSFTNGP02.phx.gbl...
>>>> Pegasus [MVP] <news@microsoft.com> wrote:
>>>>> "Lanwench [MVP - Exchange]"
>>>>> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote
>>>>> in message news:ejnCrMn8JHA.2788@TK2MSFTNGP05.phx.gbl...
>>>>>> Pegasus [MVP] <news@microsoft.com> wrote:
>>>>>>> "Rich" <richjone@noemail.noemail> wrote in message
>>>>>>> news:C3ADA7D9-DD1C-4603-BC6A-8614F3EA8C1B@microsoft.com...
>>>>>>>> That worked perfectly, many thanks!
>>>>>>>
>>>>>>> Thanks for the feedback.
>>>>>>
>>>>>> Hey, Pegasus - thanks for this. I was intrigued. However, it
>>>>>> doesn't run for me. No errors. Anything special I have to do? Was
>>>>>> testing on my XP Pro workstation on a local drive, but would
>>>>>> think that would still work, right?
>>>>>
>>>>> I didn't think there would be anything I could intrigue you with
>>>>> . .
>>>>
>>>> <snort> Are you kidding? You probably don't know how often I follow
>>>> you around in Usenet like an infatuated puppy :-)
>>>>
>>>>> . I tested the code on a WinXP Pro machine and it works fine.
>>>>> Perhaps you don't have any inaccessible folders?
>>>>
>>>> I'm sure that's true; I'm a local admin on this PC (the cobbler's
>>>> children go barefoot). I guess I was expecting it to log something
>>>> anyway, but it just opened 'n closed without a peep.
>>>>
>>>> The "System Volume
>>>>> Information" folder is by default inaccessible, even to
>>>>> administrators.
>>>>> Try the VB Script below. I left it in its original form [other
>>>>> than adding line numbers] so that you can modify it more easily.
>>>>> I also improved it a little: By removing line [15] you can focus
>>>>> on the inaccessible folder names, without getting distracted by
>>>>> the many other folder names.
>>>>> [01] Const sSource = "d:\User Files"
>>>>> [02] Dim sPath
>>>>> [03]
>>>>> [04] Set oFSO = CreateObject("Scripting.FileSystemObject")
>>>>> [05] CheckFolder oFSO.GetFolder(sSource)
>>>>> [06]
>>>>> [07] Sub CheckFolder (oFldr)
>>>>> [08] On Error Resume Next
>>>>> [09] For Each oSubfolder In oFldr.Subfolders
>>>>> [10] If IsEmpty (oSubfolder) Then
>>>>> [11] WScript.echo "***Error*** """ & sPath & """"
>>>>> [12] Err.Clear
>>>>> [13] Else
>>>>> [14] sPath = oSubfolder.path
>>>>> [15] WScript.Echo "Processing """ & sPath & """"
>>>>> [16] CheckFolder oSubfolder
>>>>> [17] End If
>>>>> [18] Next
>>>>> [19] End Sub
>>>>
>>>> I'm getting a WHS error....
>>>> Script <path & filename>
>>>> Line: 1
>>>> Char: 6
>>>> Error: Syntax error
>>>> Code: 800A03EA
>>>> Source: Microsoft VBScript compliation error
>>>>
>>>> I'm not a VB person so I'm not sure what it's fussing about (or
>>>> where to start counting characters in line 1). I created a new
>>>> notepad file, copied and pasted in your text above, replaced
>>>> "d"\user files" with "c:" and saved it to my desktop with a .vbs
>>>> extension. This could be really nice if I can get it working!
>>>
>>> Did you remove the [xx] bit at the start of each line?
>>> You should invoke the script from a Command Prompt (not from the Run
>>> box) like so:
>>> cscript //nologo c:\perms.vbs
>>
>> LOL - I hadn't, but I have done now and it runs.
>> Now where does it output (put out??) other than within the command
>> line? I can't see any log, etc.
>
> In this version, output is written to the console. You could pick it
> up by redirecting it into a file. If you intend to use the script
> often then I'd be happy to modify it so that its outpput goes into
> some text file.

That would be really nice. I run into this sort of situation all the time
and it's a huge PITA. :-D
Re: List of which folders I don't have permission to as an admin [message #164404 is a reply to message #164389] Mon, 22 June 2009 13:14 Go to previous messageGo to next message
news  is currently offline news  Switzerland
Messages: 2294
Registered: July 2009
Senior Member
"Lanwench [MVP - Exchange]"
<lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in message
>
> That would be really nice. I run into this sort of situation all the time
> and it's a huge PITA. :-D

Here you go, with my compliments. There are two versions: One relies on
parameters embedded in the script, the other takes command line parameters.
You can invoke both with the command
wscript NoAccess.vbs
If you want a "no-prompt" operation then you need to remove the "msgbox"
functions. Enjoy!

[01] '---------------------------
[02] 'Locate inaccessible folders
[03] '22.6.2009 FNL
[04] '---------------------------
[05] sSource = "d:\User Files"
[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

[01] '---------------------------
[02] 'Locate inaccessible folders
[03] '22.6.2009 FNL
[04] '---------------------------
[05] Dim sPath, iCount, oFSO
[06] Set oFSO = CreateObject("Scripting.FileSystemObject")
[07]
[08] '--------------------------
[09] 'Process command line parms
[10] '--------------------------
[11] If WScript.Arguments.Count <> 2 _
[12] Then ErrorExit "Usage: NoAccess.vbs NameOfFolder NameOfLogFile"
[13]
[14] sSource = WScript.Arguments(0)
[15] sLogFile = WScript.Arguments(1)
[16] If Not oFSO.FolderExists(sSource) _
[17] Then ErrorExit ("The folder " & sSource & " does not exist.")
[18]
[19] On Error Resume Next
[20] Set oLogFile = oFSO.CreateTextFile(sLogFile, True)
[21] If Err.number > 0 _
[22] Then ErrorExit "Cannot open " & sLogFile & vbLf & Err.Description
[23] On Error Goto 0
[24]
[25] '-------------------------------------
[26] 'Recursively scan the nominated folder
[27] '-------------------------------------
[28] iCount = 0
[29] CheckFolder oFSO.GetFolder(sSource)
[30] oLogFile.Close
[31] MsgBox iCount & " inaccessible folder(s) found." & vbLf _
[32] & "Check the file " & sLogFile & " for details."
[33]
[34] '---------------
[35] 'Scan one folder
[36] '---------------
[37] Sub CheckFolder (oFldr)
[38] On Error Resume Next
[39] For Each oSubfolder In oFldr.Subfolders
[40] If IsEmpty (oSubfolder) Then
[41] oLogFile.WriteLine "***Error*** """ & sPath & """"
[42] Err.Clear
[43] iCount = iCount + 1
[44] Else
[45] sPath = oSubfolder.path
[46] CheckFolder oSubfolder
[47] End If
[48] Next
[49] End Sub
[50]
[51] Sub ErrorExit (msg)
[52] MsgBox msg
[53] WScript.Quit 1
[54] End Sub
Re: List of which folders I don't have permission to as an admin [message #164517 is a reply to message #164404] Thu, 25 June 2009 08:19 Go to previous message
lanwench  is currently offline lanwench  United States
Messages: 1684
Registered: July 2009
Senior Member
Pegasus [MVP] <news@microsoft.com> wrote:
> "Lanwench [MVP - Exchange]"
> <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
> message
>>
>> That would be really nice. I run into this sort of situation all the
>> time and it's a huge PITA. :-D
>
> Here you go, with my compliments. There are two versions: One relies
> on parameters embedded in the script, the other takes command line
> parameters. You can invoke both with the command
> wscript NoAccess.vbs
> If you want a "no-prompt" operation then you need to remove the
> "msgbox" functions. Enjoy!
>
> [01] '---------------------------
> [02] 'Locate inaccessible folders
> [03] '22.6.2009 FNL
> [04] '---------------------------
> [05] sSource = "d:\User Files"
> [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
>
> [01] '---------------------------
> [02] 'Locate inaccessible folders
> [03] '22.6.2009 FNL
> [04] '---------------------------
> [05] Dim sPath, iCount, oFSO
> [06] Set oFSO = CreateObject("Scripting.FileSystemObject")
> [07]
> [08] '--------------------------
> [09] 'Process command line parms
> [10] '--------------------------
> [11] If WScript.Arguments.Count <> 2 _
> [12] Then ErrorExit "Usage: NoAccess.vbs NameOfFolder NameOfLogFile"
> [13]
> [14] sSource = WScript.Arguments(0)
> [15] sLogFile = WScript.Arguments(1)
> [16] If Not oFSO.FolderExists(sSource) _
> [17] Then ErrorExit ("The folder " & sSource & " does not exist.")
> [18]
> [19] On Error Resume Next
> [20] Set oLogFile = oFSO.CreateTextFile(sLogFile, True)
> [21] If Err.number > 0 _
> [22] Then ErrorExit "Cannot open " & sLogFile & vbLf & Err.Description
> [23] On Error Goto 0
> [24]
> [25] '-------------------------------------
> [26] 'Recursively scan the nominated folder
> [27] '-------------------------------------
> [28] iCount = 0
> [29] CheckFolder oFSO.GetFolder(sSource)
> [30] oLogFile.Close
> [31] MsgBox iCount & " inaccessible folder(s) found." & vbLf _
> [32] & "Check the file " & sLogFile & " for details."
> [33]
> [34] '---------------
> [35] 'Scan one folder
> [36] '---------------
> [37] Sub CheckFolder (oFldr)
> [38] On Error Resume Next
> [39] For Each oSubfolder In oFldr.Subfolders
> [40] If IsEmpty (oSubfolder) Then
> [41] oLogFile.WriteLine "***Error*** """ & sPath & """"
> [42] Err.Clear
> [43] iCount = iCount + 1
> [44] Else
> [45] sPath = oSubfolder.path
> [46] CheckFolder oSubfolder
> [47] End If
> [48] Next
> [49] End Sub
> [50]
> [51] Sub ErrorExit (msg)
> [52] MsgBox msg
> [53] WScript.Quit 1
> [54] End Sub

Yay - thank you so much. I will play with this. :-)
Previous Topic:Is it possible to run a Repair Install onServer 2003 Dynamic Mirro
Next Topic:Roaming Profile help please
Goto Forum:
  


Current Time: Tue Aug 22 14:50:13 EDT 2017

Total time taken to generate the page: 0.05312 seconds
.:: Contact :: Home ::Sitemap::.

Powered by: FUDforum 3.0.0RC2.
Copyright ©2001-2009 FUDforum Bulletin Board Software