Enables tracing of the specified trace source instance(s) for the duration of the expression or command.
Snap-In: Microsoft.PowerShell.Utility
Syntax:
Trace-Command
[-Name] <String[]> [-Expression] <ScriptBlock> [ [-Option] <PSTraceSourceOptions>] [-InputObject <PSObject>] [-ListenerOption <TraceOptions>] [-FilePath <String>] [-Force] [-Debugger] [-PSHost] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>]
Trace-Command
[-Name] <String[]> [-Command] <String> [ [-Option] <PSTraceSourceOptions>] [-InputObject <PSObject>] [-ArgumentList <Object[]>] [-ListenerOption <TraceOptions>] [-FilePath <String>] [-Force] [-Debugger] [-PSHost] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>]
Description:
This cmdlet turns on tracing for the trace source(s) for the given expression. The behavior is exactly same as in Set-TraceSource, except the setting is temporary and applied during the execution of the given expression. The second parameterSet using -Command behaves more like a command would in a pipeline. For example, command discovery is not repeated for each incoming object.