Advertisement
Guest User

TFS Build Powershell Script to deploy to server

a guest
Oct 10th, 2016
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. param (
  2.     [Parameter(Mandatory=$true)][string]$OutputDir
  3.  )
  4.  
  5. #Enable Remote Powershell
  6. winrm set winrm/config/client '@{TrustedHosts="DevWeb"}'
  7.  
  8. #Stop IIS on the target server, required as .net core locks the files during runtime
  9. invoke-command -computername "DevWeb" -scriptblock {iisreset /stop}
  10.  
  11. #Trigger robocopy to mirror the source and destination folder
  12. robocopy $OutputDir '\\DevWeb\d$\Website\' /mir /s /r:1 /w:1
  13.  
  14. #Start iis on the target server
  15. invoke-command -computername "DevWeb" -scriptblock {iisreset}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement