你能帮我完成我的小命令,我用它来搜索来自区域内150台服务器的远程服务器的文件
Invoke-Command -ComputerName (Get-Content F:\Serverlist.txt) -ScriptBlock {dir c:\ -Recurse -File | where {$_.Extension -eq ".pst"} |select Length,LastAccessTime,Name,@{n='Path';e={$_.fullname}},@{n='Owner';e={$_.getaccesscontrol().owner}}} |Export-Csv F:\files.csv -NoTypeInformation
我在这里搜索C盘中多个服务器的.PST文件,我想在上面的命令中包含其他驱动器F.
答案 0 :(得分:1)
Dir
是Get-ChildItem
的别名,您可以使用Get-Alias dir
查看此内容。
如果您使用Get-Help Get-ChildItem -Full
查看帮助,则会看到-Path
接受多项输入:
-Path <String[]>
Specifies a path to one or more locations.
所以我认为解决方案是替换:
dir c:\
使用此Get-ChildItem C:, F: