Get-SmbSession

Get-SmbSession

Retrieves information about the Server Message Block (SMB) sessions that are currently established between the SMB server and the associated clients.

Syntax

Parameter Set: Query (cdxml)
Get-SmbSession [[-SessionId] <UInt64[]> ] [[-ClientComputerName] <String[]> ] [[-ClientUserName] <String[]> ] [[-ScopeName] <String[]> ] [[-ClusterNodeName] <String[]> ] [-AsJob] [-CimSession <CimSession[]> ] [-IncludeHidden] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Detailed Description

The Get-SmbSession cmdlet retrieves basic information about the Server Message Block (SMB) sessions that are currently established between the SMB server and the associated clients.

Parameters

-AsJob

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CimSession<CimSession[]>

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ClientComputerName<String[]>

Specifies the client computer name from which the only sessions are returned.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ClientUserName<String[]>

Specifies the name of the user whose sessions are retrieved.

Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ClusterNodeName<String[]>

Specifies, in the case of a share hosted by a Windows cluster, the name of the server which is hosting the sessions is retrieved.

Aliases

none

Required?

false

Position?

6

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-IncludeHidden

Indicates that sessions that are created and used internally will be enumerated as well.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ScopeName<String[]>

Specifies the scope of the sessions being retrieved.

Aliases

none

Required?

false

Position?

5

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SessionId<UInt64[]>

Specifies the identifiers (IDs) that uniquely identify the sessions for which the information is retrieved.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ThrottleLimit<Int32>

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbSession

    The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.
    The MSFT_SmbSession object represents the sessions established between the SMB server and the associated clients.

Examples

EXAMPLE 1

This example retrieves information about the SMB sessions that are currently established between the SMB server and the associated clients.

PS C:\> Get-SmbSession

EXAMPLE 2

This example retrieves information about the SMB session identified as 8813272891621 that is currently established between the SMB server and the associated clients.

PS C:\> Get-SmbSession -SessionId 8813272891621

EXAMPLE 3

This example retrieves information about the SMB sessions that are currently established between the SMB server and the SMB client at the IP address 192.168.102.14.

PS C:\> Get-SmbSession -ClientComputerName 192.168.102.14

EXAMPLE 4

This example retrieves information about the SMB sessions that are currently established between the SMB server and the SMB client with the user name Contoso\Contoso-HV1$.

PS C:\> Get-SmbSession -ClientUserName Contoso\Contoso-HV1$

EXAMPLE 5

This example retrieves all of the information about the SMB session identified as 8813272891441 that are currently established between the SMB server and the SMB client.

PS C:\> Get-SmbSession -SessionId 8813272891441 | Select-Object -Property *

Close-SmbSession