Trying to Scan my SFTP Server for a file uploaded in the last 60 mins

Advertisement

Woods13
Joined:
Posts:
1
Location:
Brainerd, MN

Trying to Scan my SFTP Server for a file uploaded in the last 60 mins

Hello,
Im trying to scan my SFTP server for any file thats been uploaded in the last 60 mins.

So Far I have:
# Set credentials to a PSCredential Object.
$credential = Get-Credential
 
# Create a WinSCP Session.
$session = New-WinSCPSession -Hostname xxxxxxx -Credential $credential -SshHostKeyFingerprint ""ssh-ed25519 255 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""
 
# Using the WinSCPSession, show files in the directory.
Get-WinSCPChildItem -WinSCPSession $session -Path /sftperic
 
# Remove the WinSCPSession after completion.
Remove-WinSCPSession -WinSCPSession $session
I keep getting an error
New-WinSCPSession : A parameter cannot be found that matches parameter name 'Hostname'.
At line:5 char:30
+ $session = New-WinSCPSession -Hostname xxxxxxx -Credential $cre ...
+                              ~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-WinSCPSession], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,New-WinSCPSession
 
Get-WinSCPChildItem : Missing an argument for parameter 'Path'. Specify a parameter of type 'System.String[]' and try again.
At line:8 char:45
+ Get-WinSCPChildItem -WinSCPSession $session -Path
+                                             ~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-WinSCPChildItem], ParameterBindingException
    + FullyQualifiedErrorId : MissingArgument,Get-WinSCPChildItem
Im fairly new with scripting and powershell in general so any suggestions anyone has would help greatly.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum