Editar

Compartir a través de


Get-FileShare

Retrieves file share objects and their properties.

Syntax

Get-FileShare
   [-Name <String[]>]
   [-Protocol <FileSharingProtocol[]>]
   [-FileServer <CimInstance>]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [<CommonParameters>]
Get-FileShare
   [-UniqueId <String[]>]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [<CommonParameters>]
Get-FileShare
   [-Name <String[]>]
   [-Protocol <FileSharingProtocol[]>]
   [-Volume <CimInstance>]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [<CommonParameters>]
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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:CimSession[]
Aliases:Session
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FileServer

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

Type:CimInstance
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of the file share to get.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:FileSharingProtocol[]
Accepted values:NFS, SMB
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Subsystem

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

Type:CimInstance
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UniqueId

Specifies a unique ID.

Type:String[]
Aliases:Id
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Volume

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

Type:CimInstance
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Notes

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