Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. $Source=Read-Host "C:\Dane"
  2. $Destination=Read-Host "C:\Shares\Backup"
  3. $Folder=Read-Host "File Server"
  4. $validation=Test-Path $Destination
  5.  
  6.  
  7. New-PSDrive -Name "Backup" -PSProvider FileSystem -Root $Destination
  8.  
  9. if ($validation -eq $True){
  10.  
  11. Set-Location Backup:
  12. }
  13. else{
  14.  
  15. Write-Host "Error!Run Script Again"
  16.  
  17. break
  18. }
  19.  
  20. robocopy $Source $Destination\$Folder *.* /mir /sec
  21.  
  22.  
  23.  
  24.  
  25. Function Pause{
  26.  
  27. Write-Host "Backup Sucessfull!!! `n"
  28.  
  29. Write-Host "Press any key to continue..."
  30.  
  31. $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null
  32.  
  33. }
  34.  
  35.  
  36.  
  37. Pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement