Bearbeiten

Freigeben über


Get-FileShare

Retrieves file share objects and their properties.

Syntax

ByFileServer (Default)

Get-FileShare
    [-Name <String[]>]
    [-Protocol <FileSharingProtocol[]>]
    [-FileServer <CimInstance>]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [<CommonParameters>]

ByUniqueId

Get-FileShare
    [-UniqueId <String[]>]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [<CommonParameters>]

ByVolume

Get-FileShare
    [-Name <String[]>]
    [-Protocol <FileSharingProtocol[]>]
    [-Volume <CimInstance>]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [<CommonParameters>]

BySubsystem

Get-FileShare
    [-Name <String[]>]
    [-Protocol <FileSharingProtocol[]>]
    [-Subsystem <CimInstance>]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [<CommonParameters>]

Description

The Get-FileShare cmdlet gets objects that correspond to the file shares on the specified server. You must have local administrator credentials on a server to retrieve the objects.

Examples

Example 1: Get all file shares on the local server

PS C:\>Get-FileShare

This command lists all the file shares on the local server. You must have local administrator permissions on the server to run this command.

Example 2: Get all NFS file shares on the specified file server

PS C:\>Get-FileShare -Protocol NFS -FileServer (Get-StorageFileServer -FriendlyName "FileServer01")

This command lists all NFS file shares on the file server named FileServer01. You must have local administrator credentials on the server to run this command. The command gets the file server by using the Get-StorageFileServer cmdlet.

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

-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

-FileServer

Specifies the file server on which the file share is hosted. To obtain a FileServer, use the Get-StorageFileServer cmdlet.

Parameter properties

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

Parameter sets

ByFileServer
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the file share to get.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByFileServer
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByVolume
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
BySubsystem
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Protocol

Specifies the file sharing protocol of the file shares that this cmdlet gets. The acceptable values for this parameter are: SMB and NFS.

Parameter properties

Type:

FileSharingProtocol[]

Default value:None
Accepted values:NFS, SMB
Supports wildcards:False
DontShow:False

Parameter sets

ByFileServer
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByVolume
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
BySubsystem
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Subsystem

Specifies the storage subsystem from which to get file shares. To obtain a StorageSubsystem object, use the Get-StorageSubSystem cmdlet.

Parameter properties

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

Parameter sets

BySubsystem
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
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

-UniqueId

Specifies a unique ID.

Parameter properties

Type:

String[]

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

Parameter sets

ByUniqueId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Volume

Specified the volume object that contains the file share to get. To obtain a volume, use the Get-Volume cmdlet.

Parameter properties

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

Parameter sets

ByVolume
Position:Named
Mandatory:False
Value from pipeline:True
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.

Notes

  • When used in Failover Cluster, cmdlets from the Storage module operate on cluster level (all servers in the cluster).