I have the need to determine the ACLs for a range of files and have found code-snippets and such that have helped and for the most part seem to work well. However, one thing is beyond me at the moment:
1) Get-ACL: Get-Acl on a .pst file, it gives me an error, no matter the location of the file, whether it is open in outlook or not, no matter of size or such things. I can see the file with Get-ChildItem, and indeed using icacls at the command line or the Windows Explorer Properties menu, I can get the acl information. So acl info is there and exists. But when I try the get-acl command, I get the following:
PS C:\users\Shadow\Desktop> get-acl '.\PersonalFolders.pst'
get-acl : Attempted to perform an unauthorized operation.
At line:1 char:1
+ get-acl '.\PersonalFolders.pst'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Acl], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetAclCommand
As part of experimenting, I tried the get-acl command against a text file that had the pst extension, and it didn't work. I renamed an actual pst file with another extension (such as .pdf) and it worked.
I also tried the GetAccessControl command and it worked when applied to a non-pst file, such as: (get-item 'f.pdf').getAccessControl().Access
However, if it was a pst file, such as (get-item 'f.pst').getAccessControl().Access, it bombed with:
Exception calling "GetAccessControl" with "0" argument(s): "Attempted to perform an unauthorized operation."
At line:1 char:2
+ (get-item '.\f.pst').getAccessControl().Access
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : UnauthorizedAccessException
Suggestions? Thoughts?
Thanks in advance,
W