MSHのデバッグ手法(5)


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

trace-expression

単一のコマンドラインに対してトレースソースを有効にするには以下の構文を利用します。

To a file

trace-expression –name -Options All –Expression { } –file

  • トレース情報をファイルに出力します。
To the Monad host

trace-expression –name -Options All –Expression { } –MshHost

  • トレース情報をコンソールに出力します。
To the debugger

trace-expression –name -Options All –Expression { } -debugger

  • トレース情報をデバッガに出力します。(使い方調査中・・・)

にはトレースソースを設定します。
トレースソースは「get-tracesource」コマンドで取得可能です。

MSH C:\> get-tracesource | sort name

Options  Name             Listeners  Description
-------  ----             ---------  -----------
None     AliasCommands    {Default}  The *-alias commands
None     AliasInfo        {Default}  The command information for aliases. Aliases
None     AliasProvider    {Default}  The CmdletProvider for shell aliases
None     AssemblyConfigur {Default}  AssemblyConfigurationEntry
None     ASSERT           {Default}  Msh Assertions
None     AuthorizationMan {Default}  tracer for AuthorizationManager
None     AutomationEngine {Default}  AutomationEngine
None     CertificateProvi {Default}  The core command provider for certificates
None     Cmdlet           {Default}  Cmdlet
None     CmdletConfigurat {Default}  CmdletConfigurationEntry
None     CmdletInfo       {Default}  The command information for MSH cmdlets that
(中略)