Reputation: 317
How to transfer file from Window Server to Linux without using 3rd party software? I just can use pure PowerShell script to transfer zip file.
I'm using PowerShell v2.0 (I know it's pretty old and I don't have privilege to update to current version - only can use for Shell.Application
script)
$timestamp = (Get-Date).AddMonths(-1).ToString('yyyy-MM-dd')
$todaysDate = (Get-Date).AddDays(-1)
$source = "D:\Testing\*.csv", "D:\Testing\*.csv"
$target = "D:\Testing\bin\$timestamp.zip"
$housekeepZipFile = "D:\Testing\bin\*.zip"
$locationToTransfer = "D:\Testing\bin\*.zip"
$mftFileTransfer = "[email protected]:/UserName/Outbox"
Get-ChildItem -Path $locationToTransfer –Recurse | Where-Object {
$_.LastWriteTime -gt (Get-Date).AddDays(-1)
} | Copy-Item -Destination $mftFileTransfer -Force
Is my syntax correct? Just now tried, seems not receive any file.
Using Window Server 2008
Upvotes: 1
Views: 692
Reputation: 202594
As Ansgar already commented, keys are used with SSH/SFTP. There's no support for SSH/SFTP in PowerShell nor in Windows 2008. If you need to use SSH/SFTP, you have to use 3rd party software/library.
And as already said above, you do not need install privileges to use WinSCP nor PuTTY/psftp.
Upvotes: 1