Guest User

Untitled

a guest
Jul 3rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #ftp server
  2. $ftp = 'ftp://servername/site/wwwroot/'
  3. $username = 'username'
  4. $password = 'password'
  5.  
  6. $destinationPath = "D:\home\site\wwwroot\"
  7. $webclient = New-Object System.Net.WebClient
  8. $webclient.Credentials = New-Object System.Net.NetworkCredential($username, $password)
  9.  
  10. try
  11. {
  12. Write-Output "Uploading..."
  13. $webclient.UploadFile($ftp + "file.xml", $destinationPath + "file.xml")
  14. $result = 0
  15. }
  16. catch
  17. {
  18. Write-Output $_.Exception.Message -ForegroundColor Red
  19. $result = 1
  20. }
  21.  
  22. Write-Output "Done!"
  23.  
  24. # Reporting result to Azure
  25. exit $result
Add Comment
Please, Sign In to add comment