搜索网络中的所有.pst文件

时间:2017-01-31 13:05:44

标签: powershell

$computers = net view
foreach ($computer in $computers) {
    Get-ChildItem -Resurse *.pst
}

我不确定如何使用此搜索\\PC\c$,这甚至可以那样工作吗?

1 个答案:

答案 0 :(得分:0)

您可以访问管理员共享(您需要管理员权限才能访问它们)。语法为\\hostname\drive$\folder(例如:\\MYMachineName\c$\MyFolder)。

如果您要在pst驱动器中搜索C个文件:

net view | ForEach-Object {
    $CDrivePath = ($_.Trim()) + "\C$"
    Get-ChildItem -Path $CDrivePath -Recurse -Filter "*.pst"
} 

但要注意这个命令很费时,你可能想要缩小搜索范围,而不是搜索整个计算机。