Get-AzStorageFileHandle

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

Syntax

Get-AzStorageFileHandle
   [-ShareName] <String>
   [[-Path] <String>]
   [-Recursive]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzStorageFileHandle
   [-Share] <CloudFileShare>
   [[-Path] <String>]
   [-Recursive]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzStorageFileHandle
   [-Directory] <CloudFileDirectory>
   [[-Path] <String>]
   [-Recursive]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzStorageFileHandle
   [-File] <CloudFile>
   [-Recursive]
   [-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

PS C:\>Get-AzStorageFileHandle -ShareName "mysharename" -Recursive | Sort-Object ClientIP,OpenTime 

HandleId    Path                  ClientIp       ClientPort OpenTime             LastReconnectTime FileId               ParentId             SessionId          
--------    ----                  --------       ---------- --------             ----------------- ------               --------             ---------          
28506980357                       104.46.105.229 49805      2019-07-29 08:37:36Z                   0                    0                    9297571480349046273
28506980537 dir1                  104.46.105.229 49805      2019-07-30 09:28:48Z                   10376363910205800448 0                    9297571480349046273
28506980538 dir1                  104.46.105.229 49805      2019-07-30 09:28:48Z                   10376363910205800448 0                    9297571480349046273
28582543365                       104.46.119.170 51675      2019-07-30 09:29:32Z                   0                    0                    9477733061320772929
28582543375 dir1                  104.46.119.170 51675      2019-07-30 09:29:38Z                   10376363910205800448 0                    9477733061320772929
28582543376 dir1                  104.46.119.170 51675      2019-07-30 09:29:38Z                   10376363910205800448 0                    9477733061320772929

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

PS C:\>Get-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2'  -Recursive -First 2

HandleId    Path      ClientIp       ClientPort OpenTime             LastReconnectTime FileId               ParentId             SessionId          
--------    ----      --------       ---------- --------             ----------------- ------               --------             ---------          
24057151779 dir1/dir2 104.46.105.229 50861      2019-06-18 07:39:23Z                   16140971433240035328 11529285414812647424 9549812641162070049
24057151780 dir1/dir2 104.46.105.229 50861      2019-06-18 07:39:23Z                   16140971433240035328 11529285414812647424 9549812641162070049

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

PS C:\>Get-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2/test.txt' -skip 2 -First 4 

HandleId    Path               ClientIp       ClientPort OpenTime             LastReconnectTime FileId              ParentId             SessionId          
--------    ----               --------       ---------- --------             ----------------- ------              --------             ---------          
24055513248 dir1/dir2/test.txt 104.46.105.229 49817      2019-06-18 08:21:59Z                   9223407221226864640 16140971433240035328 9338416139169958321
24055513249 dir1/dir2/test.txt 104.46.105.229 49817      2019-06-18 08:21:59Z                   9223407221226864640 16140971433240035328 9338416139169958321
24055513252 dir1/dir2/test.txt 104.46.105.229 49964      2019-06-18 08:22:54Z                   9223407221226864640 16140971433240035328 9338416138431762125
24055513253 dir1/dir2/test.txt 104.46.105.229 49964      2019-06-18 08:22:54Z                   9223407221226864640 16140971433240035328 9338416138431762125

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.

Type:System.Nullable`1[System.Int32]
Aliases:ClientTimeoutPerRequestInSeconds
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ConcurrentTaskCount

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

Type:System.Nullable`1[System.Int32]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Context

Azure Storage Context Object

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-DefaultProfile

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Directory

CloudFileDirectory object indicated the base folder where the files/directories would be listed.

Type:CloudFileDirectory
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-File

CloudFile object indicated the file to list File Handles.

Type:CloudFile
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-First

Gets only the first 'n' objects.

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

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Path

Path to an existing file/directory.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Recursive

List handles Recursively. Only works on File Directory.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServerTimeoutPerRequest

The server time out for each request in seconds.

Type:System.Nullable`1[System.Int32]
Aliases:ServerTimeoutPerRequestInSeconds
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Share

CloudFileShare object indicated the share where the files/directories would be listed.

Type:CloudFileShare
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ShareName

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

Type:String
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Skip

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

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

Inputs

CloudFileShare

CloudFileDirectory

Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext

Outputs

FileHandleResultSegment