Edit

Share via


Get-AzStorageFileHandle

Lists file handles of a file share, a file directory or a file.

Syntax

ShareName (Default)

Get-AzStorageFileHandle
    [-ShareName] <String>
    [[-Path] <String>]
    [-Recursive]
    [-DisAllowTrailingDot]
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <IAzureContextContainer>]
    [-ConcurrentTaskCount <Int32>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

Share

Get-AzStorageFileHandle
    [-ShareClient] <ShareClient>
    [[-Path] <String>]
    [-Recursive]
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <IAzureContextContainer>]
    [-ConcurrentTaskCount <Int32>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

Directory

Get-AzStorageFileHandle
    [-ShareDirectoryClient] <ShareDirectoryClient>
    [[-Path] <String>]
    [-Recursive]
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <IAzureContextContainer>]
    [-ConcurrentTaskCount <Int32>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

File

Get-AzStorageFileHandle
    [-ShareFileClient <ShareFileClient>]
    [-Recursive]
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <IAzureContextContainer>]
    [-ConcurrentTaskCount <Int32>]
    [-IncludeTotalCount]
    [-Skip <UInt64>]
    [-First <UInt64>]
    [<CommonParameters>]

Description

The Get-AzStorageFileHandle cmdlet lists file handles of a file share, or file directory or a file.

Examples

Example 1: List all file handles on a file share recursively, and sort by ClientIp and OpenTime

Get-AzStorageFileHandle -ShareName "mysharename" -Recursive | Sort-Object ClientIP,OpenTime
HandleId    Path                  ClientIp       ClientPort OpenTime             LastReconnectTime FileId               ParentId SessionId           ClientName
--------    ----                  --------       ---------- --------             ----------------- ------               -------- ---------           ----------
28506980357                       104.46.105.229 49805      2019-07-29 08:37:36Z                   0                    0        9297571480349046273 myclientvm
28506980537 dir1                  104.46.105.229 49805      2019-07-30 09:28:48Z                   10376363910205800448 0        9297571480349046273 myclientvm
28506980538 dir1                  104.46.105.229 49805      2019-07-30 09:28:48Z                   10376363910205800448 0        9297571480349046273 myclientvm
28582543365                       104.46.119.170 51675      2019-07-30 09:29:32Z                   0                    0        9477733061320772929 myclientvm
28582543375 dir1                  104.46.119.170 51675      2019-07-30 09:29:38Z                   10376363910205800448 0        9477733061320772929 myclientvm
28582543376 dir1                  104.46.119.170 51675      2019-07-30 09:29:38Z                   10376363910205800448 0        9477733061320772929 myclientvm

This command lists file handles on a file share, and sort the output by ClientIp, then by OpenTime.

Example 2: List first 2 file handles on a file directory recursively

Get-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2'  -Recursive -First 2
HandleId    Path      ClientIp       ClientPort OpenTime             LastReconnectTime FileId               ParentId             SessionId           ClientName
--------    ----      --------       ---------- --------             ----------------- ------               --------             ---------           ----------
24057151779 dir1/dir2 104.46.105.229 50861      2019-06-18 07:39:23Z                   16140971433240035328 11529285414812647424 9549812641162070049 myclientvm
24057151780 dir1/dir2 104.46.105.229 50861      2019-06-18 07:39:23Z                   16140971433240035328 11529285414812647424 9549812641162070049 myclientvm

This command lists first 2 file handles on a file directory recursively .

Example 3: List the 3rd to the 6th file handles on a file

Get-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2/test.txt' -skip 2 -First 4
HandleId    Path               ClientIp       ClientPort OpenTime             LastReconnectTime FileId              ParentId             SessionId           ClientName
--------    ----               --------       ---------- --------             ----------------- ------              --------             ---------           ----------
24055513248 dir1/dir2/test.txt 104.46.105.229 49817      2019-06-18 08:21:59Z                   9223407221226864640 16140971433240035328 9338416139169958321 myclientvm
24055513249 dir1/dir2/test.txt 104.46.105.229 49817      2019-06-18 08:21:59Z                   9223407221226864640 16140971433240035328 9338416139169958321 myclientvm
24055513252 dir1/dir2/test.txt 104.46.105.229 49964      2019-06-18 08:22:54Z                   9223407221226864640 16140971433240035328 9338416138431762125 myclientvm
24055513253 dir1/dir2/test.txt 104.46.105.229 49964      2019-06-18 08:22:54Z                   9223407221226864640 16140971433240035328 9338416138431762125 myclientvm

This command lists the 3rd to the 6th file handles on a file.

Parameters

-ClientTimeoutPerRequest

The client side maximum execution time for each request in seconds.

Parameter properties

Type:

Nullable<T>[Int32]

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

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ConcurrentTaskCount

The total amount of concurrent async tasks. The default value is 10.

Parameter properties

Type:

Nullable<T>[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

-Context

Azure Storage Context Object

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisAllowTrailingDot

Disallow trailing dot (.) to suffix directory and file names.

Parameter properties

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

Parameter sets

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

-First

Gets only the first 'n' objects.

Parameter properties

Type:UInt64
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

-IncludeTotalCount

Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns 'Unknown total count'. Currently, this parameter does nothing.

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

-Path

Path to an existing file/directory.

Parameter properties

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

Parameter sets

ShareName
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
Share
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
Directory
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Recursive

List handles Recursively. Only works on File Directory.

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

-ServerTimeoutPerRequest

The server time out for each request in seconds.

Parameter properties

Type:

Nullable<T>[Int32]

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

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ShareClient

ShareClient object indicated the share where the files/directories would list File Handles

Parameter properties

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

Parameter sets

Share
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-ShareDirectoryClient

ShareDirectoryClient object indicated the base folder where the files/directories would list File Handles

Parameter properties

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

Parameter sets

Directory
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-ShareFileClient

ShareFileClient object indicated the file to list File Handles.

Parameter properties

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

Parameter sets

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

-ShareName

Name of the file share where the files/directories would be listed.

Parameter properties

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

Parameter sets

ShareName
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Skip

Ignores the first 'n' objects and then gets the remaining objects.

Parameter properties

Type:UInt64
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

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.

Inputs

ShareClient

ShareDirectoryClient

ShareFileClient

IStorageContext

Outputs

PSFileHandle