Retrieve the SMB shares on the computer.
Syntax Get-SmbShare [[-Name] String[]] [-Scoped Boolean] [[-ScopeName] String[] [-Special Boolean[]] [-ContinuouslyAvailable Boolean] [-ShareState ShareState[]] [-FolderEnumerationMode FolderEnumerationMode[]] [-CachingMode CachingMode[]] [-LeasingMode LeasingMode[]] [-ConcurrentUserLimit UInt32[]] [-AvailabilityType AvailabilityType[]] [-CaTimeout UInt32[]] [-EncryptData Boolean] [-CompressData Boolean] [-IncludeHidden] [-SmbInstance SmbInstance] [-CimSession CimSession[]] [-ThrottleLimit Int32] [-AsJob] [CommonParameters] Key -AsJob Run the cmdlet as a background job. Use this parameter to run commands that take a long time to complete. -AvailabilityType Specifies the cluster type of the shares being enumerated. NonClustered | Clustered | ScaleOut | CSV | DFS -CachingMode Specify the caching mode of the offline files for the SMB share. There are five caching modes: None Prevent users from storing documents and programs offline. Manual Allow users to identify the documents and programs that they want to store offline. Programs Automatically store documents and programs offline. Documents Automatically store documents offline. BranchCache Enable BranchCache and manual caching of documents on the shared folder. -CATimeout The continuous availability time-out of the shares being enumerated. -CimSession Run the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of New-CimSession or Get-CimSession. The default is the current session on the local computer. -CompressData Indicate that the shares being enumerated should request compression from clients. -ConcurrentUserLimit The maximum number of concurrently connected users that the SMB share may accommodate. If this parameter is set to zero (0), then the number of users is unlimited. By default, new SMB shares have no limit on the number of concurrent connections. -Confirm Prompt for confirmation before running the cmdlet. -ContinuouslyAvailable Indicate whether the share is continuously available (SMB Transparent Failover setup in Windows Failover Clustering configuration). -Description A description of the SMB share, the description is an optional field, so may not be populated. -EncryptData Indicates whether the SMB share is encrypted. -FolderEnumerationMode Which files and folders in the new SMB share will be visible to the users. Accepted values: AccessBased SMB does not the display the files and folders for a share to a user unless that user has rights to access the files and folders. By default, access-based enumeration is disabled for new SMB shares. Unrestricted Display files and folders to a user even if the user does not have access permission to them. -Force Run the commandwithout asking for user confirmation. -InputObject The input object to be used in a pipeline command. -LeasingMode Specifies SMB leasing and oplock behaviors for application compatibility. Accepted values: 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). -Name The name of one or more SMB shares to retrieve. -PassThru Return an object representing the item with which you are working. By default, this cmdlet does not generate any output. -ScopeName The scope name of the SMB share. -SmbInstance The input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet. -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 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. -WhatIf Shows what would happen if the cmdlet runs. The cmdlet is not run.
This cmdlet returns a MSFT_SmbShare object that represents the modified share.
Get SMB shares:
PS C:\> Get-SMBShare
Name ScopeName Path Description
---- --------- ---- -----------
ADMIN$ * C:\Windows Remote Admin
C$ * C:\ Default share
ClusterStorage$ SS64-SO C:\ClusterStorage Cluster Shared Volumes Def...
D$ * D:\ Default share
F$ * F:\ Default share
G$ * G:\ Default share
H$ * H:\ Default share
I$ SS64-FS I:\ Cluster Default Share
I$ * I:\ Default share
IPC$ * Remote IPC
J$ SS64-FS J:\ Cluster Default Share
J$ * J:\ Default share
K$ * K:\ Default share
L$ * L:\ Default share
M$ * M:\ Default share
N$ * N:\ Default share
VMS1 SS64-FS I:\VMS
VMS2 SS64-FS J:\VMS
VMS3 SS64-SO C:\ClusterStorage\Volume1\VMS
VMS4 SS64-SO C:\ClusterStorage\Volume2\VMS
VMS5 * D:\VMS
Get a specific SMB share on the local computer:
PS C:\>Get-SmbShare -Name "VMS1" | Format-List
Name : VMS1
ScopeName : SS64-FS
Path : I:\VMS
Description :
Display all properties about a specific SMB share on the local computer in a list:
PS C:\> Get-SmbShare -Name "VMS1" | Format-List -Property *
PresetPathAcl : System.Security.AccessControl.DirectorySecurity
ShareState : Online
...
Get shares on the local computer that have scaled out availability:
PS C:\> Get-SmbShare | Where-Object -Property AvailabilityType -Eq ScaleOut Name ScopeName Path Description ---- --------- ---- ----------- ClusterStorage$ SS64-SO C:\ClusterStorage Cluster Shared Volumes Def... VMS3 SS64-SO C:\ClusterStorage\Volume1\VMS VMS4 SS64-SO C:\ClusterStorage\Volume2\VMS
Get shares that are connected to a specific server:
PS C:\> Get-SmbShare -ScopeName "SS64-FS" Name ScopeName Path Description ---- --------- ---- ----------- I$ SS64-FS I:\ Cluster Default Share J$ SS64-FS J:\ Cluster Default Share VMS1 SS64-FS I:\VMS VMS2 SS64-FS J:\VMS
"Interactive users are twice as productive when the computer response time is 0.25 second instead of 2.0 Seconds" ~ Doherty and Kelisky IBM Computer systems Journal, 1984
New-SmbShare - Create an SMB share.
Set-SmbShare - Modify the properties of an SMB share.
ShareAudit.vbs - Audit shares across the domain (Redmond Mag).
Get-SmbShareAccess - Retrieve the ACL of an SMB share.
Grant-SmbShareAccess - Add an allow ACE for a trustee to the security descriptor of the SMB share.