MSHのデバッグ手法(3)

MSHのデバッグ手法(2) - PowerShell Memoの続きです。

エラー内容を分析する(2)

「System.Management.Automation.ErrorRecord」オブジェクトの

  • 「InvocationInfo」プロパティ
  • 「FullyQualifiedErrorId」プロパティ

もエラー内容を把握するのに役に立ちます。

「InvocationInfo」
MSH C:\> $thisError.InvocationInfo.gettype().fullname
System.Management.Automation.InvocationInfo
MSH C:\> $thisError.InvocationInfo

MyCommand        : System.Management.Automation.CmdletInfo
ScriptLineNumber : 1
OffsetInLine     : -2147483648
ScriptName       :
Line             : start-service $servicename
PositionMessage  :
                   At line:1 char:14
                   + start-service  <<<< $servicename
InvocationName   : start-service
PipelineLength   : 0
PipelinePosition : 0
「FullyQualifiedErrorId」
MSH C:\> $thisError.FullyQualifiedErrorId
ParameterArgumentValidationErrorNullNotAllowed,
 System.Management.Automation.Commands.StartServiceCommand