Get-SmbShareAccess
Get-SmbShareAccess [-Name*] <String[]> [[-ScopeName] <String[]>] [-CimSession <CimSession[]>] [-SmbInstance{Default | CSV}] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Get-SmbShareAccess [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
The Get-SmbShareAccess cmdlet gets objects that represent the rights that have been granted to security principles to access the Server Message Block (SMB) share.
Parameters
-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.
-Name <String[]>
- This value is required
- Accepts pipeline input ByPropertyName
Specifies the name of the SMB share for which the access rights are retrieved.
-ScopeName [<String[]>]
- Accepts pipeline input ByPropertyName
Specifies the scope of the share by name.
-SmbInstance
[<Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance>]
- Accepts pipeline input ByPropertyName
Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.
-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 PowerShellr 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.
-Confirm [<SwitchParameter>]
- Default value is false
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
-WhatIf [<SwitchParameter>]
- Default value is false
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.
Inputs
NoneOutputs
Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbShareAccessControlEntryExamples
-
Get the ACL of a share:
PS C:\> Get-SmbShareAccess -Name "VMFiles" Name ScopeName AccountName AccessControlType AccessRight ---- --------- ----------- ----------------- ----------- VMFiles Contoso-SO Contoso\Administrator Allow Full VMFiles Contoso-SO Contoso\Contoso-HV1$ Allow Full
This command retrieves the ACL of an SMB share named VMFiles.
-
Get the ACL of a share for a server:
PS C:\> Get-SmbShareAccess -Name "VMFiles" -ScopeName "Contoso-SO" | Format-List Name : VMFiles ScopeName : Contoso-SO AccountName : Contoso\Administrator AccessControlType : Allow AccessRight : Full Name : VMFiles ScopeName : Contoso-SO AccountName : Contoso\Contoso-HV1$ AccessControlType : Allow AccessRight : Full
This command displays the information about the ACL of an SMB share named VMFiles connected to the SMB server named Contoso-SO.
This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.
PowerShell Commands