Edit

Share via


Get-SmbShare

Retrieves the SMB shares on the computer.

Syntax

Default (Default)

Get-SmbShare
    [[-Name] <String[]>]
    [[-ScopeName] <String[]>]
    [-Scoped <Boolean[]>]
    [-Special <Boolean[]>]
    [-ContinuouslyAvailable <Boolean[]>]
    [-ShareState <ShareState[]>]
    [-FolderEnumerationMode <FolderEnumerationMode[]>]
    [-CachingMode <CachingMode[]>]
    [-LeasingMode <LeasingMode[]>]
    [-DirectoryHandleLeasing <Boolean[]>]
    [-ConcurrentUserLimit <UInt32[]>]
    [-AvailabilityType <AvailabilityType[]>]
    [-CaTimeout <UInt32[]>]
    [-EncryptData <Boolean[]>]
    [-CompressData <Boolean[]>]
    [-IsolatedTransport <Boolean[]>]
    [-QoSFlowScope <QoSFlowScope[]>]
    [-QoSPolicyId <String[]>]
    [-IncludeHidden]
    [-SmbInstance <SmbInstance>]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [<CommonParameters>]

Description

The Get-SmbShare cmdlet retrieves objects that represent the Server Message Block (SMB) shares being displayed by the computer.

Examples

Example 1: Get SMB shares on a local computer

Get-SMBShare
Name                          ScopeName                     Path                          Description
----                          ---------                     ----                          -----------
ADMIN$                        *                             C:\\Windows                   Remote Admin
C$                            *                             C:\\                          Default share
D$                            *                             D:\\                          Default share
F$                            *                             F:\                           Default share
IPC$                          *                                                           Remote IPC
VMS1                          *                             I:\VMS

This command retrieves the SMB shares on the computer.

Example 2: Get a specific SMB share on the local computer

Get-SmbShare -Name "VMS1"
Name                          ScopeName                     Path                          Description
----                          ---------                     ----                          -----------
VMS1                          *                             I:\VMS

This command retrieves information about the SMB share named VMS1 on the local computer.

Example 3: Display information about the SMB shares on a remote computer

Get-SmbShare -CimSession "NEDFS1"

Name        ScopeName Path                Description   PSComputerName
----        --------- ----                -----------   --------------
ADMIN$      *         C:\\Windows          Remote Admin  ae-dfsr-sr-01
C$          *         C:\\                 Default share ae-dfsr-sr-01
D$          *         D:\\                 Default share ae-dfsr-sr-01
E$          *         E:\\                 Default share ae-dfsr-sr-01
IPC$        *                              Remote IPC    ae-dfsr-sr-01
IT dept     *         D:\\data\IT dept                   ae-dfsr-sr-01
procedures  *         D:\\hr\procedures                  ae-dfsr-sr-01
VHD and ISO *         D:\\data\VHD and ISO               ae-dfsr-sr-01

This command displays the information about the SMB shares on the remote computer NEDFS1.

Example 4: Display all properties about a specific SMB share on the local computer in a list

Get-SmbShare -Name "VMS1" | Format-List -Property *
PresetPathAcl         : System.Security.AccessControl.DirectorySecurity
ShareState            : Online
AvailabilityType      : Clustered
ShareType             : FileSystemDirectory
FolderEnumerationMode : Unrestricted
CachingMode           : Manual
CATimeout             : 0
ConcurrentUserLimit   : 0
ContinuouslyAvailable : True
CurrentUsers          : 3
Description           :
EncryptData           : False
Name                  : VMS1
Path                  : I:\VMS
Scoped                : True
ScopeName             : *
SecurityDescriptor    : O:BAG:DUD:(A;;FA;;;S-1-5-21-219828122-4198910963-4161819395-500)(A;;FA;;;S-1-5-21-219828122-419
                        8910963-4161819395-1106)(A;;FA;;;S-1-5-21-219828122-4198910963-4161819395-1109)
ShadowCopy            : False
Special               : False
Temporary             : False
Volume                : \\?\Volume{b02c4ba7-e6f1-11e1-93eb-0008a1c0ef0d}\
PSComputerName        :
CimClass              : ROOT/Microsoft/Windows/SMB:MSFT_SmbShare
CimInstanceProperties : {AvailabilityType, CachingMode, CATimeout, ConcurrentUserLimit...}
CimSystemProperties   : Microsoft.Management.Infrastructure.CimSystemProperties

This command displays all of the information about the SMB share named VMS1 on the local computer as a formatted list.

Example 5: Get shares on the local failover cluster computer that have scale out availability

Get-SmbShare | Where-Object -Property AvailabilityType -Eq ScaleOut
Name                          ScopeName                     Path                          Description
----                          ---------                     ----                          -----------
ClusterStorage$               Contoso-SO                    C:\\ClusterStorage             Cluster Shared Volumes Def...
VMS3                          Contoso-SO                    C:\\ClusterStorage\Volume1\VMS
VMS4                          Contoso-SO                    C:\\ClusterStorage\Volume2\VMS

This command retrieves the SMB shares on the computer that have scaled out availability.

Example 6: Get shares that are connected to a local failover cluster file server resource named "Contoso-FS"

Get-SmbShare -ScopeName "Contoso-FS"
Name                          ScopeName                     Path                          Description
----                          ---------                     ----                          -----------
I$                            Contoso-FS                    I:\                           Cluster Default Share
J$                            Contoso-FS                    J:\                           Cluster Default Share
VMS1                          Contoso-FS                    I:\VMS
VMS2                          Contoso-FS                    J:\VMS

This command retrieves the SMB shares on the Windows Server failover cluster that are connected to the clustered file server resource named Contoso-FS.

Parameters

-AsJob

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AvailabilityType

Specifies the cluster type of the shares being enumerated.

Parameter properties

Type:

AvailabilityType[]

Default value:None
Accepted values:NonClustered, Clustered, ScaleOut, CSV, DFS
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-CachingMode

Specifies the caching mode of the offline files for the SMB share. There are five caching modes:

  • BranchCache - Enables BranchCache and manual caching of documents on the shared folder.
  • Documents - Automatically stores documents offline.
  • Manual - Allows users to identify the documents and programs that they want to store offline.
  • Programs - Automatically stores documents and programs offline.
  • None - Prevents users from storing documents and programs offline.

Parameter properties

Type:

CachingMode[]

Default value:None
Accepted values:None, Manual, Documents, Programs, BranchCache, Unknown
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-CATimeout

Specifies the continuous availability time-out of the SMB share.

Parameter properties

Type:

UInt32[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-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.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Session

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CompressData

Indicates that the shares being enumerated should request compression from clients.

Parameter properties

Type:

Boolean[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ConcurrentUserLimit

Specifies the concurrent user limit of the shares being enumerated.

Parameter properties

Type:

UInt32[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ContinuouslyAvailable

Indicates that the shares being enumerated should be continuously available.

Parameter properties

Type:

Boolean[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EncryptData

Indicates that the shares being enumerated should be encrypted.

Parameter properties

Type:

Boolean[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FolderEnumerationMode

Specifies the folder enumeration mode of the shares being enumerated.

Parameter properties

Type:

FolderEnumerationMode[]

Default value:None
Accepted values:AccessBased, Unrestricted
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-IncludeHidden

Indicates that shares that are created and used internally are also enumerated.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IsolatedTransport

Treats this share to be a distinct file server instance. Clients will establish a new set of connections to access the share.

Parameter properties

Type:

Boolean[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-LeasingMode

Specifies SMB leasing and oplock behaviors for application compatibility. The acceptable values for this parameter are:

  • Full: Use default lease and oplock behaviors from SMB3.
  • Shared: Grant read-caching lease but not write or handle-caching.
  • None: No oplocks or leases, behave like SMB1 (not recommended).

Important

We Don't recommend disabling oplocks, but may be required in some scenarios. For more information, see SMB1 Product Clearinghouse.

Parameter properties

Type:LeasingMode
Default value:None
Accepted values:Full, Shared, None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies one or more SMB shares by share name.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-QoSFlowScope

Specifies the Quality of Service (QoS) flow scope for the SMB share. The QoS flow scope determines how QoS policies are applied to SMB traffic. The accepted values are:

  • File: Applies the QoS policy to file operations, each file handle is considered a flows.
  • Share: Applies the QoS policy to SMB share connections, each connection is considered a flow.
  • User: Applies the QoS policy to each user connection, each user connection is considered a flow.
  • Session: Applies the QoS policy to each SMB session, each session connection is considered a flow.

The default value is None.

Parameter properties

Type:

QoSFlowScope[]

Default value:None
Accepted values:File, Share, User, Session
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-QoSPolicyId

Specifies the QoS policy ID for the SMB share. The QoS policy ID is used to apply QoS policies to SMB traffic. The default value is None.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Scoped

Indicates that the shares to be numerated should be scoped.

Parameter properties

Type:

Boolean[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ScopeName

Specifies the scope of the share by name. For use with Windows Server failover cluster file server resources.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ShareState

Specifies the state of the shares being enumerated.

Parameter properties

Type:

ShareState[]

Default value:None
Accepted values:Pending, Online, Offline
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SmbInstance

Specifies the SMB share instance type. Accepted values are:

  • Default: Used for operations where a client device opens a file on a share on the server.
  • CSV: Used by Windows Failover Clusters.
  • SBL: Used by Storage Spaces Direct.
  • SR: Used by Storage Replica.

Parameter properties

Type:SmbInstance
Default value:None
Accepted values:Default, CSV, SBL, SR
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Special

Indicates that the shares to be numerated should be special. Admin share, default shares, IPC$ share are examples of special shares.

Parameter properties

Type:

Boolean[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ThrottleLimit

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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

Boolean

Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareState

Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.FolderEnumerationMode

Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.CachingMode

Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.LeasingMode

UInt32

Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.AvailabilityType

Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.QoSFlowScope

Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance

Outputs

CimInstance

CimInstance

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_SmbShare object represents the SMB shares on the computer.