A little guidance required on with 'ConvertTo-HTML' please RRS feed

  • Question

  • I'm trying to create a script which simply displays who are our Office 365 Group owners (so we can publish a list on our intranet which automatically gets updated once a day for example).

    Running this command displays exactly what I want, what I want to know is how do I output this into a readable html file? 

    Get-UnifiedGroup | Format-Table DisplayName,ManagedBy,AccessType

    The following command does produce a .html file but does not display the output of my command, instead I see a load of information about Microsoft.PowerShell.Commands.Internal.Format.TableHeaderInfo

    Get-UnifiedGroup | Format-Table DisplayName,ManagedBy,AccessType | ConvertTo-HTML | Out-File C:\scripts\file.html

    Some guidance into the right direction would be hugely appreciated, thanks! 

    • Edited by Kelvin.uk Friday, October 27, 2017 11:43 AM
    Friday, October 27, 2017 11:42 AM


  • You should use Select-Object instead of Format-Table if you like to pipe the data to other cmdlets

    Best regards (79,108,97,102|%{[char]$_})-join''

    • Edited by BOfH-666 Friday, October 27, 2017 12:09 PM
    • Proposed as answer by jrv Friday, October 27, 2017 1:25 PM
    • Marked as answer by Richard MuellerMVP Friday, November 3, 2017 1:27 PM
    Friday, October 27, 2017 12:08 PM