Gets the file/SMB shares on the local computer.
Get-FileShare [[-Name] <String>] [<CommonParameters>]
The Get-FileShare
function uses WMI to get the file/SMB shares on the current/local computer. The returned objects are Win32_Share
WMI objects.
Use the Name
paramter to get a specific file share by its name. If a share with the given name doesn't exist, an error is written and nothing is returned.
The Name
parameter supports wildcards. If you're using wildcards to find a share, and no shares are found, no error is written and nothing is returned.
Get-FileShare
was added in Carbon 2.0.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Name | String | The name of a specific share to retrieve. Wildcards accepted. If the string contains WMI sensitive characters, you'll need to escape them. |
false | false |
Get-FileShare
Demonstrates how to get all the file shares on the local computer.
Get-FileShare -Name 'Build'
Demonstrates how to get a specific file share.
Get-FileShare -Name 'Carbon*'
Demonstrates that you can use wildcards to find all shares that match a wildcard pattern.