将 get-ChildItem 与 ACL powershell 结合起来
我正在使用 Power shell 寻找有关文件信息的帮助,除了所有者信息之外,我们已经获得了大部分需要的信息。
下面的代码返回超过 1 年的目录列表,但问题是我们似乎无法在其中显示所有者信息:
gci -r
"D:\Network Shares\ICT\ICT\Network Shares\ICT\Innovations\Robert Pitt" | ?
{
$_.LastWriteTime -lt (Get-Date).AddYears(-1)} >> D:\temp\ICTFileAge.txt
}
我们知道名为 Get-ACL
的命令,但是不确定如何将这一切联系起来。
大家有什么想法请提出来,谢谢
Im looking for some help on information on files using Power shell, we have got most of when we need apart from the owner information.
the code below returns a list of directories that are older then 1 year, but the problem is we cannot seem to get the Owner Information to show in there:
gci -r
"D:\Network Shares\ICT\ICT\Network Shares\ICT\Innovations\Robert Pitt" | ?
{
$_.LastWriteTime -lt (Get-Date).AddYears(-1)} >> D:\temp\ICTFileAge.txt
}
We know of the command called Get-ACL
, but were unsure how to tie it all up.
Anyone have any ideas please, thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样的东西吗?
Something like this?
通过使用计算属性来拉入 ACL 所有者字段,可以简化代码:
The code could be simplified by using a calculated property to pull in the ACL owner field: