I want to add another BaseUrl to my existing TopologyManager website.

I am trying this without any luck. Suggestions?

Set-TtmWebsite -Id Website2 -BaseUrls @{"http://localhost:8999/","http://localhost:58300/"}
Set-TtmWebsite -id Website1 -BaseUrls "http://local.devstage.web.com", "http://local1.devstage.web.com"

For completeness, here's a similar useful technique. If you wish to use the same content service for multiple websites, you may already have things set up for one or more Urls and wish to add another. Rather than type everything in again, you can start by querying the existing website data, modify the BaseUrls property and save it back:

$websiteData = Get-TtmWebsite -id Website6
$websiteData.BaseUrls += "http://www.example.com"
Set-TtmWebsite -Data $websiteData

In PowerShell, @{} is used for hash tables (key-value pairs), whereas @() is used for arrays.

So this will work:

Set-TtmWebsite -Id Website2 -BaseUrls @("http://localhost:8999/","http://localhost:58300/")
  • The comma operator is a perfectly valid (and explicit) way of creating an array. The array subexpression operator @() is sometimes tidier if you are using a function that may return a single value.
    – Dominic Cronin
    Aug 26 '16 at 11:04
  • Yeah, fair enough, but I don't know how else to put it. I just find that people often confuse comma-separated array values with separate parameters. I think the @() syntax makes it clearer that you aren't passing in multiple parameters but rather a single array. Aug 26 '16 at 13:28
  • Anyway, my answer is probably better without getting into personal preferences so I've removed that part. I just wanted to show yet another way to set array values. Aug 26 '16 at 13:40
  • I think you are right. For readability when you don't know the reader's level of Powershell experience. Someone who is already far enough to be comfortable using commas might save the keystrokes, but we shouldn't write for Powershell Monks.
    – Dominic Cronin
    Aug 26 '16 at 13:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.