我使用DU.exe在PowerShell脚本捕捉到一个远程文件夹的大小,如下面的代码:PowerShell的Du.exe错误
$Duexe ="c:\du\du.exe"
$unc = "\\$server\$Letter$\$Name"
write-host "Processing: " $unc
$stuff = du -q "\\$server\$Letter$\$Name" 2>&1
$formated = $stuff | Format-Table -auto
write-host $stuff
我重定向stderror停止造成的错误“-q”开关。然而输出连续发生如下错误:
System.Management.Automation.RemoteException
In context:
Files: 290215 Directories: 2246 Size: 128,529,542,967 bytes Size on disk: 128,529,542,967 bytes System.Management.Automation.RemoteException
这是为什么?如果我在powershell之外运行du,那么在相同的unc路径上不会发生错误。
我刚刚发现,如果我trunror重定向它并没有显示它显示的messgae howevere: – Daniel 2011-02-18 12:24:45