raandree / NTFSSecurity

Managing permissions with PowerShell is only a bit easier than in VBS or the command line as there are no cmdlets for most day-to-day tasks like getting a permission report or adding permission to an item. PowerShell only offers Get-Acl and Set-Acl but everything in between getting and setting the ACL is missing. This module closes the gap.
MIT License
431 stars 61 forks source link

Error when processing a whole drive #24

Closed GarryLovesey closed 6 years ago

GarryLovesey commented 7 years ago

I got the following error when trying to get the permissions for the whole drive.

Command used:

PS C:\> Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Csv permissions.csv

Error Received:
Get-NTFSAccess : Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
At line:1 char:26
+ Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Csv permissio ...
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (C:\Data\Temp\wbxtra_11152016_142541.wbt:String) [Get-NTFSAccess], ArgumentOutOfRangeException
    + FullyQualifiedErrorId : ReadSecurityError,NTFSSecurity.GetAccess

Get-NTFSAccess : Unable to find the specified file.
At line:1 char:26
+ Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Csv permissio ...
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (C:\Data\Temp\OI...9D2.0\A271AFDA.:String) [Get-NTFSAccess], FileNotFoundException
   \ + FullyQualifiedErrorId : ReadFileError,NTFSSecurity.GetAccess
raandree commented 6 years ago

Unfortunately, I could not repro this. I have exported the permissions of my whole C drive and only a handful of could not be read:

PS C:\> Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Csv permissions.csv
Get-NTFSAccess : Unable to find the specified file.
At line:1 char:26
+ Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Cs ...
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (C:\Windows\Syst...les\CldFlt3.etl:String) [Get-NTFSAccess], FileNotFoundException
    + FullyQualifiedErrorId : ReadFileError,NTFSSecurity.GetAccess

Get-NTFSAccess : Unable to find the specified file.
At line:1 char:26
+ Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Cs ...
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (C:\Windows\Syst...RecoTel.etl.001:String) [Get-NTFSAccess], FileNotFoundException
    + FullyQualifiedErrorId : ReadFileError,NTFSSecurity.GetAccess

Get-NTFSAccess : Unable to find the specified file.
At line:1 char:26
+ Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Cs ...
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (C:\Windows\Syst...eUnlock.etl.001:String) [Get-NTFSAccess], FileNotFoundException
    + FullyQualifiedErrorId : ReadFileError,NTFSSecurity.GetAccess

Get-NTFSAccess : Unable to find the specified file.
At line:1 char:26
+ Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Cs ...
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (C:\Windows\Syst...I\LwtNetLog.etl:String) [Get-NTFSAccess], FileNotFoundException
    + FullyQualifiedErrorId : ReadFileError,NTFSSecurity.GetAccess

Get-NTFSAccess : Unable to find the specified file.
At line:1 char:26
+ Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Cs ...
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (C:\Windows\Syst...es\WMI\Wifi.etl:String) [Get-NTFSAccess], FileNotFoundException
    + FullyQualifiedErrorId : ReadFileError,NTFSSecurity.GetAccess

PS C:\> Get-Content -Path C:\permissions.csv | Measure-Object

Count    : 815204
Average  : 
Sum      : 
Maximum  : 
Minimum  : 
Property : 
GarryLovesey commented 6 years ago

Thanks for looking anyway…..

Garry Lovesey Information Services | Manufacturing Systems Support Honda of the UK Manufacturing Ltd Tel: +44 (0)1793 831183 Ext: 5413 Mobile: +44 (0)7989 487635 E-Mail: garry.lovesey@honda-eu.commailto:garry.lovesey@honda-eu.com Website: www.hondamanufacturing.co.ukhttp://www.hondamanufacturing.co.uk

From: Raimund Andrée [MSFT] notifications@github.com Sent: 26 July 2018 13:41 To: raandree/NTFSSecurity NTFSSecurity@noreply.github.com Cc: Garry Lovesey Garry.Lovesey@honda-eu.com; Author author@noreply.github.com Subject: Re: [raandree/NTFSSecurity] Error when processing a whole drive (#24)

Unfortunately, I could not repro this. I have exported the permissions of my whole C drive and only a handful of could not be read:

PS C:> Get-ChildItem -recurse | Get-NTFSAccess -ExcludeInherited | Export-Csv permissions.csv

Get-NTFSAccess : Unable to find the specified file.

At line:1 char:26

Get-NTFSAccess : Unable to find the specified file.

At line:1 char:26

Get-NTFSAccess : Unable to find the specified file.

At line:1 char:26

Get-NTFSAccess : Unable to find the specified file.

At line:1 char:26

Get-NTFSAccess : Unable to find the specified file.

At line:1 char:26

PS C:> Get-Content -Path C:\permissions.csv | Measure-Object

Count : 815204

Average :

Sum :

Maximum :

Minimum :

Property :

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/raandree/NTFSSecurity/issues/24#issuecomment-408083621, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Af7vxBHrv-xsm7qTAZ24rAkvTBBm6y0aks5uKbjAgaJpZM4QWPl4.

Disclaimer: Honda of the UK Manufacturing Limited Registered Office: Highworth Road, South Marston, Swindon, Wiltshire SN3 4TZ Registered in England and Wales No. 1887872 Website: www.hondamanufacturing.co.uk This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Honda of the UK Manufacturing Limited. If you are not the intended recipient of this email and its attachments, you must take no action based on them, nor must you copy or show them to anyone. Please contact the sender if you believe that you have received this email in error and delete it from your system. Please note: Honda of the UK Manufacturing Limited may monitor email traffic data and also the content of emails for the purpose of ensuring the appropriate use of its information technology facilities.

raandree commented 6 years ago

Closing this now. The next time I will respond in time :)