Remove-CimSession

Remove-CimSession

Removes one or more CIM sessions.

構文

Parameter Set: CimSessionSet
Remove-CimSession [-CimSession] <CimSession[]> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ComputerNameSet
Remove-CimSession [-ComputerName] <String[]> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: InstanceIdSet
Remove-CimSession -InstanceId <Guid[]> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: NameSet
Remove-CimSession -Name <String[]> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SessionIdSet
Remove-CimSession [-Id] <UInt32[]> [-Confirm] [-WhatIf] [ <CommonParameters>]

詳細説明

The Remove-CimSession cmdlet removes one or more CIM session objects from the local Windows PowerShell® session.

パラメーター

-CimSession<CimSession[]>

Runs the command using the specified CIM session. Enter a variable that contains the CIM session, or a command that creates or gets the CIM session, such as the New-CimSession or Get-CimSession cmdlets. For more information, see about_CimSessions.

エイリアス

なし

必須?

true

位置は?

1

既定値

なし

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

true (ByValue, ByPropertyName)

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

false

-ComputerName<String[]>

Specifies the name of the computer on which you want to run the CIM operation. You can specify a fully qualified domain name (FQDN) or a NetBIOS name.

If you specify this parameter, the cmdlet creates a temporary session to the specified computer using the WsMan protocol.

If you do not specify this parameter, the cmdlet performs the operation on the local computer using Component Object Model (COM).

If multiple operations are being performed on the same computer, connecting using a CIM session gives better performance.

エイリアス

cn, ServerName

必須?

true

位置は?

1

既定値

なし

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

true (ByPropertyName)

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

false

-Id<UInt32[]>

Specifies the ID of the CIM session to remove. Specify one or more IDs separated by commas, or use the range operator (..) to specify a range of IDs.

An ID is an integer that uniquely identifies the CIM session in the current Windows PowerShell session. It is easier to remember and type than InstanceId, but it is unique only within the current Windows PowerShell session.

For more information about the range operator, see about_Operators.

エイリアス

なし

必須?

true

位置は?

1

既定値

なし

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

true (ByPropertyName)

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

false

-InstanceId<Guid[]>

Specifies the instance ID of the CIM session to remove.

InstanceID is a Globally Unique Identifier (GUID) that uniquely identifies a CIM session. The InstanceID is unique, even when you have multiple sessions running in Windows PowerShell.

The InstanceID is stored in the InstanceID property of the object that represents a CIM session.

エイリアス

なし

必須?

true

位置は?

named

既定値

なし

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

true (ByPropertyName)

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

false

-Name<String[]>

Specifies the friendly name of the CIM session to remove. You can use wildcard characters with this parameter.

エイリアス

なし

必須?

true

位置は?

named

既定値

なし

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

true (ByPropertyName)

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

false

-Confirm

コマンドレットを実行する前に、ユーザーに確認を求めます。

必須?

false

位置は?

named

既定値

false

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

false

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

false

-WhatIf

コマンドレットを実行するとどのような結果になるかを表示します。コマンドレットは実行されません。

必須?

false

位置は?

named

既定値

false

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

false

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

false

<CommonParameters>

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

入力

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

  • None

    This cmdlet accepts no input objects.

出力

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

  • System.Object

    This cmdlet returns an object that contains CIM session information.

Example 1: Remove all the CIM sessions

This command retrieves all the available CIM sessions on the local computer using the Get-CimSession cmdlet, and then removes them using the Remove-CimSession.

PS C:\> Get-CimSession | Remove-CimSession

Example 2: Remove a specific CIM session

This command removes the CIM session that has an ID value of 5.

PS C:\> Remove-CimSession -Id 5

Example 3: Show the list of CIM sessions to remove by using the WhatIf parameterby the parameter

This command uses the common parameter WhatIf to specify that the removal should not be done, but only output what would happen if it were done.

PS C:\> Remove-CimSession -Name a* -WhatIf

関連トピック

Get-CimSession

New-CimSession