SHARE
TWEET

TFS Build Powershell Script to deploy to server

a guest Oct 10th, 2016 90 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}
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top