PowerShell捕获的异常

时间:2017-08-29 11:23:10

标签: powershell

我有以下例外:

New-PSDrive : The user name or password is incorrect
At C:\Users\t\Desktop\a\b.ps1:23 char:22
+ ...    $Drive = New-PSDrive -Name "T" -PSProvider "FileSystem" -Root "\\$ 
...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (T:PSDriveInfo) [New-PSDrive], Win32Exception
+ FullyQualifiedErrorId : CouldNotMapNetworkDrive,Microsoft.PowerShell.Commands.NewPSDriveCommand

如何确定我应该在try-catch块中捕获哪个异常?

0 个答案:

没有答案