【发布时间】:2014-04-22 13:44:38
【问题描述】:
无论我做什么我都无法捕捉到这种类型的异常:
Start-BitsTransfer : HTTP status 407: Proxy authentication is required.
At line:4 char:6
+ Start-BitsTransfer -Source $url -Destination $fullPath
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-BitsTransfer], Exception
+ FullyQualifiedErrorId : StartBitsTransferCOMException,Microsoft.BackgroundIntelligentTransfer.Management.NewBitsTransferCommand
我无法使用“invoke-command”和 [System.Management.Automation.RuntimeException] (PSRemotingTransportException),因为运行远程脚本块时不支持 BITS。
怎么做?
【问题讨论】:
-
尝试通用系统异常。
Catch [system.exception]。 blogs.technet.com/b/heyscriptingguy/archive/2010/03/11/…
标签: powershell try-catch