diff --git a/Posh-SSH/Posh-SSH.psd1 b/Posh-SSH/Posh-SSH.psd1 index 728dc73..b57bef5 100644 --- a/Posh-SSH/Posh-SSH.psd1 +++ b/Posh-SSH/Posh-SSH.psd1 @@ -71,6 +71,7 @@ FunctionsToExport = @('Get-PoshSSHModVersion', 'Get-SFTPContent', 'Get-SFTPLocation', 'Get-SFTPPathAttribute', + 'Get-SFTPPathInformation', 'Get-SFTPSession', 'Get-SSHPortForward', 'Get-SSHSession', diff --git a/Posh-SSH/Posh-SSH.psm1 b/Posh-SSH/Posh-SSH.psm1 index eafd685..c146597 100644 --- a/Posh-SSH/Posh-SSH.psm1 +++ b/Posh-SSH/Posh-SSH.psm1 @@ -1890,6 +1890,78 @@ function Set-SFTPPathAttribute } } +# .ExternalHelp Posh-SSH.psm1-Help.xml +function Get-SFTPPathInformation +{ + [CmdletBinding()] + [OutputType([Renci.SshNet.Sftp.SftpFileSytemInformation])] + Param + ( + [Parameter(Mandatory=$true, + ParameterSetName = 'Index', + ValueFromPipelineByPropertyName=$true, + Position=0)] + [Alias('Index')] + [Int32[]] + $SessionId, + + [Parameter(Mandatory=$true, + ParameterSetName = 'Session', + ValueFromPipeline=$true, + Position=0)] + [Alias('Session')] + [SSH.SFTPSession[]] + $SFTPSession, + + [Parameter(Mandatory=$true, + ValueFromPipeline=$true, + Position=1)] + [string] + $Path + ) + + Begin + { + $ToProcess = @() + switch($PSCmdlet.ParameterSetName) + { + 'Session' + { + $ToProcess = $SFTPSession + } + + 'Index' + { + foreach($session in $Global:SFTPSessions) + { + if ($SessionId -contains $session.SessionId) + { + $ToProcess += $session + } + } + } + } + } + Process + { + foreach($session in $ToProcess) + { + + if (Test-SFTPPath -SFTPSession $session -Path $Path) + { + $session.Session.GetStatus($Path) + } + else + { + throw "Path $($Path) does not exist on the target host." + } + } + } + End + { + } +} + # .ExternalHelp Posh-SSH.psm1-Help.xml function New-SFTPSymlink { diff --git a/Posh-SSH/en-US/Posh-SSH.psm1-Help.xml b/Posh-SSH/en-US/Posh-SSH.psm1-Help.xml index 5f6aa9e..7bd91b9 100644 --- a/Posh-SSH/en-US/Posh-SSH.psm1-Help.xml +++ b/Posh-SSH/en-US/Posh-SSH.psm1-Help.xml @@ -884,6 +884,182 @@ CentOS Linux release 7.0.1406 (Core) + + + Get-SFTPPathInformation + Get + SFTPPathInformation + + Get the filesystem information for a specified path in a SFTP session. + + + + Get the filesystem information for a specified path in a SFTP session. + + + + Get-SFTPPathInformation + + SessionId + + SFTP Session Id of an exiting session. + + Int32[] + + Int32[] + + + None + + + Path + + Path to get information on. + + String + + String + + + None + + + + Get-SFTPPathInformation + + SFTPSession + + SFTP Session Object of an exiting session. + + SftpSession[] + + SftpSession[] + + + None + + + Path + + Path to get information on. + + String + + String + + + None + + + + + + SessionId + + SFTP Session Id of an exiting session. + + Int32[] + + Int32[] + + + None + + + Path + + Path to get information on. + + String + + String + + + None + + + SFTPSession + + SFTP Session Object of an exiting session. + + SftpSession[] + + SftpSession[] + + + None + + + + + + System.Int32[] + + + + + + + + System.String + + + + + + + + SSH.SftpSession[] + + + + + + + + + + Renci.SshNet.Sftp.SftpFileSytemInformation + + + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-SFTPPathInformation -SessionId 0 -Path "/tmp" + +FileSystemBlockSize : 4096 +BlockSize : 4096 +TotalBlocks : 238077722 +FreeBlocks : 197779304 +AvailableBlocks : 188098654 +TotalNodes : 60599664 +FreeNodes : 60257137 +AvailableNodes : 60257137 +Sid : 80809960231584831832 +IsReadOnly : False +SupportsSetUid : True +MaxNameLenght : 255 + + + + + + + + Online Version: + https://github.com/darkoperator/Posh-SSH/tree/master/docs + + + Get-SFTPSession diff --git a/Posh-SSH/en-US/PoshSSH.dll-help.xml b/Posh-SSH/en-US/PoshSSH.dll-help.xml index b743259..eaf4ae1 100644 --- a/Posh-SSH/en-US/PoshSSH.dll-help.xml +++ b/Posh-SSH/en-US/PoshSSH.dll-help.xml @@ -123,14 +123,14 @@ OperationTimeout - Timeout for execution of an operation. + Timeout for execution of an operation. Zero or below disables timeout Int32 Int32 - 5 + 0 Path @@ -372,14 +372,14 @@ OperationTimeout - Timeout for execution of an operation. + Timeout for execution of an operation. Zero or below disables timeout Int32 Int32 - 5 + 0 Path @@ -636,14 +636,14 @@ OperationTimeout - Timeout for execution of an operation. + Timeout for execution of an operation. Zero or below disables timeout Int32 Int32 - 5 + 0 Path @@ -1599,14 +1599,14 @@ HostName HostKeyName Fingerprint OperationTimeout - Operation timeout interval in seconds. + Operation timeout interval in seconds. Zero or below disables timeout Int32 Int32 - 5 + 0 KeepAliveInterval @@ -1779,14 +1779,14 @@ HostName HostKeyName Fingerprint OperationTimeout - Operation timeout interval in seconds. + Operation timeout interval in seconds. Zero or below disables timeout Int32 Int32 - 5 + 0 KeepAliveInterval @@ -1959,14 +1959,14 @@ HostName HostKeyName Fingerprint OperationTimeout - Operation timeout interval in seconds. + Operation timeout interval in seconds. Zero or below disables timeout Int32 Int32 - 5 + 0 KeepAliveInterval @@ -2630,18 +2630,6 @@ HostName HostKeyName Fingerprint 10 - - OperationTimeout - - Operation timeout interval in seconds. - - Int32 - - Int32 - - - 5 - KeepAliveInterval @@ -2926,14 +2914,14 @@ HostName HostKeyName Fingerprint OperationTimeout - Timeout for execution of an operation. + Timeout for execution of an operation. Zero or below disables timeout Int32 Int32 - 5 + 0 Port @@ -3159,14 +3147,14 @@ HostName HostKeyName Fingerprint OperationTimeout - Timeout for execution of an operation. + Timeout for execution of an operation. Zero or below disables timeout Int32 Int32 - 5 + 0 Port @@ -3395,14 +3383,14 @@ HostName HostKeyName Fingerprint OperationTimeout - Timeout for execution of an operation. + Timeout for execution of an operation. Zero or below disables timeout Int32 Int32 - 5 + 0 Path diff --git a/docs/Get-SFTPPathInformation.md b/docs/Get-SFTPPathInformation.md new file mode 100644 index 0000000..4bec3eb --- /dev/null +++ b/docs/Get-SFTPPathInformation.md @@ -0,0 +1,108 @@ +--- +external help file: Posh-SSH.psm1-Help.xml +Module Name: Posh-SSH +online version: https://github.com/darkoperator/Posh-SSH/tree/master/docs +schema: 2.0.0 +--- + +# Get-SFTPPathInformation + +## SYNOPSIS +Get the filesystem information for a specified path in a SFTP session. + +## SYNTAX + +### Index +``` +Get-SFTPPathInformation [-SessionId] [-Path] [] +``` + +### Session +``` +Get-SFTPPathInformation [-SFTPSession] [-Path] [] +``` + +## DESCRIPTION +Get the filesystem information for a specified path in a SFTP session. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-SFTPPathInformation -SessionId 0 -Path "/tmp" + +FileSystemBlockSize : 4096 +BlockSize : 4096 +TotalBlocks : 238077722 +FreeBlocks : 197779304 +AvailableBlocks : 188098654 +TotalNodes : 60599664 +FreeNodes : 60257137 +AvailableNodes : 60257137 +Sid : 80809960231584831832 +IsReadOnly : False +SupportsSetUid : True +MaxNameLenght : 255 +``` + +## PARAMETERS + +### -SessionId +SFTP Session Id of an exiting session. + +```yaml +Type: Int32[] +Parameter Sets: Index +Aliases: Index + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Path +Path to get information on. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SFTPSession +SFTP Session Object of an exiting session. + +```yaml +Type: SftpSession[] +Parameter Sets: Session +Aliases: Session + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Int32[] +### System.String +### SSH.SftpSession[] +## OUTPUTS + +### Renci.SshNet.Sftp.SftpFileSytemInformation +## NOTES + +## RELATED LINKS