Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Upload PST files to FTP server

$
0
0

Hi Guys,

I am trying to search the computer for .pst files and then upload them to a FTP server but I am running into issues.

$ftp = "ftp://url/EXTERNALS/temp/"
$user = "ftpuser"
$pass = "passw"
$files = $files=Get-ChildItem C:\ -recurse -File -Include '*.pst' -force -ErrorAction silentlycontinue 
$webclient = New-Object System.Net.WebClient 
$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)  
foreach($item in $files){ 
    $uri = New-Object System.Uri($ftp+$item.Name) 
    $webclient.UploadFile($uri,$item.FullName)
} 

It gives me the following output in console

    Directory: C:\ProgramData\CanonBJ\IJPrinter\CNMWindows\Canon MG5100 series Printer


Mode                LastWriteTime     Length Name                                                                                                            
----                -------------     ------ ----                                                                                                            
-a---        31/12/2013     13:57       3180 archive.pst                                                                                                     


    Directory: C:\Users\All Users\CanonBJ\IJPrinter\CNMWindows\Canon MG5100 series Printer


Mode                LastWriteTime     Length Name                                                                                                            
----                -------------     ------ ----                                                                                                            
-a---        31/12/2013     13:57       3180 archive.pst                                                                                                     


    Directory: C:\Users\myuser\AppData\Local\Microsoft\Outlook


Mode                LastWriteTime     Length Name                                                                                                            
----                -------------     ------ ----                                                                                                            
-a---        06/01/2014     19:33  764158976 SharePoint Lists.pst                                                                                            
Get-ChildItem : Access is denied
At line:5 char:17
+ $files = $files=Get-ChildItem C:\ -recurse -File -Include '*.pst' -force -ErrorA ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : NotSpecified: (:) [Get-ChildItem], UnauthorizedAccessException+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetChildItemCommand

The only file that gets uploaded is = Microsoft.Exchange.PST.dll

Anyone has an idea?



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>