New-PefTargetHost

New-PefTargetHost

Creates a target host object for a PEF Live Trace Session.

構文

Parameter Set: Default
New-PefTargetHost [-ComputerName] <String> [[-Credential] <PSCredential> ] [-InformationAction <System.Management.Automation.ActionPreference> {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend} ] [-InformationVariable <System.String> ] [ <CommonParameters>]

詳細説明

The New-PefTargetHost cmdlet creates a target host object that you specify as a target computer for remote tracing. You can target and add multiple computers to a Protocol Engineering Framework (PEF) Live Trace Session that you create by using this cmdlet. Use the object that this cmdlet creates as input to the Add-PefProviderConfig cmdlet.

This cmdlet uses the current user credentials by default. Provide other credentials by specifying the Credentials parameter as described in Example 2.

Note that this cmdlet enables the Microsoft-Pef-WFP-MessageProver for remote tracing. You can use this provider to capture remote traffic on a remote Windows 10 host only, and while running on a Windows 8.1, Windows Server 2012 R2, or Windows 10 computer only.

パラメーター

-ComputerName<String>

Specifies the name of the target host computer on which to run a Live Trace Session.

エイリアス

none

必須?

true

位置は?

1

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

-Credential<PSCredential>

Specifies credentials, as a PSCredential object, for the target computer specified by the ComputerName parameter. To obtain a PSCredential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.

If you do not specify a value for this parameter, this cmdlet uses the current credentials.

エイリアス

none

必須?

false

位置は?

2

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-InformationAction<System.Management.Automation.ActionPreference>

Specifies how this cmdlet responds to an information event. このパラメーターに対して使用できる値:

-- SilentlyContinue
-- Stop
-- Continue
-- Inquire
-- Ignore
-- Suspend

エイリアス

infa

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-InformationVariable<System.String>

Specifies a variable in which to store an information event message.

エイリアス

iv

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

<CommonParameters>

このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

出力

出力型は、コマンドレットによって生成されるオブジェクトの型です。

Example 1: Create a target host to use for a remote session

The first command creates a target host for the computer named Server21, by using the current cmdlet, and then stores that host in the $TargetHost variable. Because this command does not specify credentials, the command uses the current credentials.

The second command passes the host stored in $TargetHost to the Add-PefProviderConfig cmdlet, by using the pipeline operator. The command also adds a provider, and then stores the result in the $Th1p1Config variable. The Microsoft-Windows-NDIS-PacketCapture provider captures traffic at the Link Layer and above. Alternatively, you can use the Microsoft-PEF-WFP-MessageProvider provider to capture traffic above the IP/Network layer.

The final command creates a session, adds the target host as the session source, and then starts the remove Live Trace Session, by using the New-PefTraceSession, Add-PefMessageSource, and Start-PefTraceSession cmdlets. The command stores the new session in the $TraceSession01 variable. This session encapsulates the configuration settings of the previous commands in this example.

PS C:\> $TargetHost = New-PefTargetHost -ComputerName "Server21"
PS C:\> $Th1p1Config = $TargetHost | Add-PefProviderConfig -Provider "Microsoft-Windows-NDIS-PacketCapture"
PS C:\> $TraceSession01 = New-PefTraceSession -Force -Path "C:\Trace01" -SaveOnStop | Add-PefMessageSource -Source $TargetHost | Start-PefTraceSession

Example 2: Create a target host by using credentials

This example resembles the previous example, but it also includes credentials.

The first command creates a credential by using the Get-Credential cmdlet, and stores the resulting PSCredential object in the $Credential variable. The Get-Credential cmdlet prompts you for user name and password. For more information, type Get-Help Get-Credential.

The second command creates the target host as the computer named Server21 by using the current cmdlet, and then stores that host in the $targetHost variable. This command also specifies $Credential for the Credential parameter.

The third and fourth commands are the same as the second and third commands of the previous example.

PS C:\> $Credential = Get-Credential
PS C:\> $TargetHost = New-PefTargetHost -ComputerName "Server21" -Credential $Credential
PS C:\> $Th1p1Config = $TargetHost | Add-PefProviderConfig -Provider "Microsoft-Windows-NDIS-PacketCapture"
PS C:\> $TraceSession01 = New-PefTraceSession -Force -Path "C:\Trace01" -SaveOnStop | Add-PefMessageSource -Source $TargetHost | Start-PefTraceSession

関連トピック

Add-PefMessageSource

Add-PefProviderConfig

New-PefTraceSession

Start-PefTraceSession

Get-Credential