O365 Get-inboundconnector RRS feed

  • Question

  • I wan't to publish a list with domain names which are added to a specific inbound connector in Exchange Online.

    Now I have 2 lines, but it's nicer to put it on 1 line, but I don't know how. Maybe someone can help me in the right direction?

    #Export all TLS senderdomains
    $TLS = (Get-InboundConnector "receive with forced TLS").senderdomains
    $TLS2 = $TLS.substring(5) -replace ".{2}$"

    If I don't add the second line, the output will look like:

    The beginning and the end will be removed by the second line.

    The next issue is then to import it to my html template. $TLS2 gives me a list, but when I use $TLS2 in a replace in my HTML template, it will be put on one line.

    To make this user friendly to read, I want this to be in a list. Anyone?

    $html = Get-Content "[path]" | Out-String
    #Create HTML output
    $html = $html -replace "%TLS%", ($TLS2) `

    • Moved by Bill_Stewart Friday, July 7, 2017 6:20 PM Unanswerable drive-by question
    Thursday, May 4, 2017 8:30 AM

All replies

  • It is very bad programming style to force everything onto one line.  It is harder to maintain the code and much harder to debug.


    $html = Get-Contentc:\temp\file.txt
    $html = $html -replace '%TLS%',$tls2


    Thursday, May 4, 2017 9:42 AM
  • Yeah #1 isn't really a problem.

    The option you give me for #2 isn't solving my problem.
    $TLS2 gives me a list, but $html puts the output for $TLS2 on one line. The output for $html will be uploaded to a website so our users can see which domains are connected with forced TLS. To make it readable for our users, a list is beter, than all on one line.

    Output $TLS2:
    Output $html:
    DomainX DomainY DomainZ

    Thursday, May 4, 2017 11:26 AM
  • What you are asking is too vague.  It does not define what you want to do.  Forget about code and technical wording and just say what you are trying to do.

    To get a list in HTML you have to create a list or table element and populate it.

    Start here for how to use HTML:


    Thursday, May 4, 2017 3:41 PM
  • You can try this:

    $html = $html -replace '%TLS%',($tls2 -join '<br />')


    Thursday, May 4, 2017 3:46 PM
  • What I want to do is to export a list with all the domains who are added to a specific inbound connector in Exchange Online. Then I want to publish this list with domains in a HTML template.

    This HTML template is not the problem. I know that I can replace variables with de output of the Powershell strings.

    But for the readability of the created HTML document I want to publish the list of domains not in a line, but in a row, or maybe rows.

    Tuesday, May 16, 2017 2:11 PM
  • You have to convert the array of names into HTML before replacing them in the template.

    $html = $html -replace '%TLS%',($tls2 -join '<br />')


    Tuesday, May 16, 2017 2:54 PM