PowerShell - 某些文件夹上的Get-ACL错误 [英] PowerShell - Get-ACL Error on some folders

查看:73
本文介绍了PowerShell - 某些文件夹上的Get-ACL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在使用PowerShell 4,并在文件服务器上的某些文件夹上使用Get-ACL收到错误。 这是一个新的文件服务器,我刚刚通过PowerShell脚本创建了所有文件夹和应用权限。 我是所有
文件夹的管理员,本地管理员组是所有文件夹的所有者。


我正在运行每个文件夹以确保权限适用于每个用户(这些是家庭文件夹)。  Get-ACL命令的大多数文件夹按预期工作并返回ACL。 但是在很多文件夹中我得到以下
错误:


Get-ACL \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Get-Acl:方法失败,出现意外错误代码50。



行:1字符:1


+ Get-Acl \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~


    + CategoryInfo          :NotSpecified:(:) [Get-Acl],InvalidOperationException


    + FullyQualifiedErrorId:System.InvalidOperationException,Microsoft.PowerShell.Commands.GetAclCommand




我确实看到一篇帖子,建议Get-ACL与UNC路径不兼容并建议使用:


(Get-Item< UNC路径>)。getaccesscontrol()和Get-Item< UNC路径>)。getaccesscontrol(" access")  - 这两个命令也失败了同样的"方法失败,意外错误代码50"


我一直在挖掘安全属性,文件夹的所有权等等,不能到目前为止找到任何指向与Get-ACL一起使用的文件夹和不使用Get-ACL的文件夹的区别的任何内容。 如果有人有任何进一步的想法,那将是
很棒......


谢谢



凯文



解决方案


我不知道到底出了什么问题,但我建议你使用这个伟大的模块来管理NTFS权限,继承等......使用Powershell: 

https://gallery.technet.microsoft.com/ scriptcenter / 1abd77a5-9c0b-4a2b-acef-90dbb2b84e85


希望你不会遇到这些问题  :)




Hi Everyone,

I'm using PowerShell 4 and getting an error using Get-ACL on some of my folders on my file server.  This is a new file server and I have just created all of the folders and applied permissions via a PowerShell script.  I'm an admin on all of the folders and the local administrators group is the owner of all of the folders.

I'm running through each folder to ensure the permissions are proper for each user (these are home folders).  Most of the folders the Get-ACL command is working as expected and returns the ACL.  But on quite a few folders I'm getting the following error:

Get-ACL \\server\share\directory (as mentioned this works on 85% of the folders, but not on some - all created by the same powershell script)

Get-Acl : Method failed with unexpected error code 50.

At line:1 char:1

+ Get-Acl \\server\share\directory

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-Acl], InvalidOperationException

    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetAclCommand

I did see a post the suggested the Get-ACL doesn't work well with UNC paths and suggested using:

(Get-Item <UNC path>).getaccesscontrol() and Get-Item <UNC path>).getaccesscontrol("access")  - both of these commands also failed with the same "Method failed with unexpected error code 50"

I have been digging at the security properties, ownership of the folder etc and can't find anything so far that points to a difference in the folders that do work with Get-ACL and those that don't.  If anyone has any further ideas that would be great...

Thanks

Kevin

解决方案

Hi,

I don't know what's wrong exactly, but i can advise you to use this great module to manage NTFS permissions, inheritance, etc... with Powershell :  https://gallery.technet.microsoft.com/scriptcenter/1abd77a5-9c0b-4a2b-acef-90dbb2b84e85

And hopefully you won't get these issues  :)


这篇关于PowerShell - 某些文件夹上的Get-ACL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆