Automating deployment of Turnkey and MDrivenServer on IIS

Single TK or MDS Webapp

If you want to deploy the installation packages you download from https://mdriven.net/downloads, use msdeploy and run that from the command line or in a batch file.

Command syntax:

"%PROGRAMFILES%\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -setParam:"Application Path"="Default Web Site/%2" -source:package=%1 -dest:iisApp="Default Web Site/%2" -enableRule:DoNotDeleteRule

In the example above:

  • %1 is the name of the zip file you have downloaded.
  • %2 is the name of the web app and its folder name. They could be different, but that is very unusual.
  • -setParam is needed to not use the built-in path from the package. If you have used the GUI installer, you will know that you have edited that name (or removed it) many times.
  • enableRule:DoNotDeleteRule is needed to retain existing setting files and other resources (it is the default in the GUI installer).

Multiple TK and MDS

Putting the example above in a cmd file called UpdateSiteFromPackage.cmd, the following works:

Example of how to first stop two application pools, one for TK and one for MDS, and then update two TK sites and the MDS, and lastly, start the application pools again.

"%WINDIR%\system32\inetsrv\appcmd.exe" stop apppool /apppool.name:"%3"
"%WINDIR%\system32\inetsrv\appcmd.exe" stop apppool /apppool.name:"%3MDrivenServer"
CALL UpdateSiteFromPackage "%USERPROFILE%\Downloads\%1" Intranet%3
CALL UpdateSiteFromPackage "%USERPROFILE%\Downloads\%1" %3
CALL UpdateSiteFromPackage "%USERPROFILE%\Downloads\%2" %3MDrivenServer
"%WINDIR%\system32\inetsrv\appcmd.exe" start apppool /apppool.name:"%3MDrivenServer"
"%WINDIR%\system32\inetsrv\appcmd.exe" start apppool /apppool.name:"%3"

Then, put the names of the sites in another file called UpdateAllTestAndDevSites.cmd file like this:

call UpdateTkAndMdSites.cmd %1 %2 Test
call UpdateTkAndMdSites.cmd %1 %2 Dev1

Add rows for all your installed sites.

Then, you can update all your Dev and Test sites with one command. For example:

UpdateAllTestAndDevSites.cmd MDrivenTurnkey_20220321.zip MDrivenServer_20220321.zip

Remember to execute all this from an elevated command prompt!

This page was edited 47 days ago on 02/10/2024. What links here