Retrieves information about a File or Directory from an active WinSCP Session.
Get-WinSCPItem [-WinSCPSession] <Session> [[-Path] <String[]>] [[-Filter] <String>] [<CommonParameters>]
Retrieves Name, FileType, Length, LastWriteTime, FilePermissions, and IsDirectory Properties on an Item from an Active WinSCP Session.
WinSCPSession <WinSCP.Session>
A valid open WinSCP Session, returned from New-WinSCPSession.
Specifies a path to one or more locations. Wildcards are permitted. The default location is the home directory of the user making the connection.
Filter to be applied to returned objects.
CommonParameters <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
If the WinSCPSession is piped into this command, the connection will be closed and the object will be disposed upon completion of the command.
PS C:\> New-WinSCPSession -Credential (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (New-Object -TypeName System.Security.SecureString)) -HostName $env:COMPUTERNAME -Protocol Ftp | Get-WinSCPItem -Path '/rDir/rSubDir'
Directory: /rDir
FileType LastWriteTime Length Name
-------- ------------- ------ ----
D 1/1/2015 12:00:00 AM 0 /rdir/rSubDir
PS C:\> $credential = Get-Credential
PS C:\> $session = New-WinSCPSession -Credential $credential -Hostname 'myftphost.org' -SshHostKeyFingerprint 'ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx'
PS C:\> Get-WinSCPItem -WinSCPSession $session -Path '/rDir/rSubDir'
Directory: /rDir
FileType LastWriteTime Length Name
-------- ------------- ------ ----
D 1/1/2015 12:00:00 AM 0 /rdir/rSubDir