나는, 원격 폴더의 크기를 캡처하는 PowerShell 스크립트에서 다음과 같이 코드 DU.exe을 사용하고 있습니다 :에 의해 발생하는 오류를 중지 stderror을 리디렉션 내가 가진파워 쉘 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
을 "-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
왜 그렇습니까? 외부 파워 쉘에서 du를 실행하면 동일한 unc 경로에서 오류가 발생하지 않습니다.
stderror가 트렁크 방향을 바꾼다면 messgae가 표시되는 것을 알 수 있습니다. – Daniel