Mapping a Publication to a Web application using a PowerShell script
Users would typically not use a PowerShell script to map a Publication to one or more Web applications. If you are a member of the Business IT department of your organization, you would normally use the Publishing tab of the Publication; alternatively, if you are a Web content manager, you would normally use the Site Wizard in Content Manager Explorer. 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.
Procedure
Add-TtmMapping -Id MAPPINGID -CmEnvironmentId CMENVIRONMENTID
-PublicationID "tcm:X-Y-Z" -WebApplicationId WEBAPPID -RelativeUrl RELURL
- 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_IDon 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 Web site with an IDExample, the ID of the Web application to specify here for WEBAPPID would beExample_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.