Mapping a Publication to a web application using a PowerShell script

Users would typically use Content Manager Explorer, rather than a PowerShell script, to map a Publication to one or more web applications. So only if you have a pressing reason to do so, run the Add-TtmMapping script instead to link a Publication in Content Manager to (location inside) a web application.

About this task

Depending on what type of user you are, you can create the mapping in Content Manager Explorer in one of two ways:
  • If you are a member of the business IT department of your organization, you would normally use the Publishing tab of the Publication.
  • If you are a web content manager, you would normally use the Site Wizard in Content Manager Explorer.

Procedure

Create a mapping from each web application to its corresponding Publication in Content Manager by running the following command (once for each mapping):
Add-TtmMapping -Id MAPPINGID -CmEnvironmentId CMENVIRONMENTID 
   -PublicationID "tcm:X-Y-Z" -WebApplicationId WEBAPPID -RelativeUrl RELURL
where:
  • MAPPINGID is a unique ID for this mapping, for example, StagingMicrosite01Mapping.
  • CMENVIRONMENTID is the unique ID of this (possibly scaled-out) Content Manager instance. Set this to the value of the environment variable called TRIDION_CM_ENVIRONMENT_ID on any Content Manager server machine.
  • tcm:X-Y-Z is the Content Manager URI of the Publication to which you are mapping, that is, the Publication that contains the content for this specific web application, for example, "tcm:0-1-1".
  • WEBAPPID is the unique ID of the web application you are mapping to, for example, StagingMicrosite01. If you are mapping to the default web application of a website with an ID Example, the ID of the web application to specify here for WEBAPPID would be Example_RootWebApp.
  • RELURL is the relative URL from the web application context to the mapped location. If the mapped location is the root, omit this parameter.