How to format the calculated property column to remove specific string pattern?

Hi All,

I need to format the below script result, especially in the License (s) column to not show the company name.

$Office365VanityDomain = 'CorpFinanceLtd'

Get-MsolUser -All -EnabledFilter EnabledOnly |
Where {$.IsLicensed -eq $true } |
Select DisplayName,UsageLocation,Licenses, @{Label = ‘License(s)’;
Expression = {
($
.Licenses | ForEach-Object { ($.AccountSkuId | Where-Object { $.AccountSkuId -like $Office365VanityDomain }) -replace ‘$Office365VanityDomain:’ } ) -join ‘;’
}
},SignInName,UserPrincipalName,@{n=“ProxyAddresses”;e={$_.ProxyAddresses}} | ft -AutoSize


The default Licenses column shows the license information like:
{CorpFinanceLtd:MCOPSTNC, CorpFinanceLtd:ENTERPRISEPREMIUM, CorpFinanceLtd:EMSPREMIUM, CorpFinanceLtd:RIGHTSMANAGEMENT_ADHOC…}

So how do I remove the CorpFinanceLtd: prefix part, so it makes more meaningful result?

Thank you in advance.

IT, when you post code or error messages or sample data or console output format it as code, please.
In the “Text” view you can use the code tags “PRE”, in the “Visual” view you can use the format template “Preformatted”. You can go back edit your post and fix the formatting - you don’t have to create a new one.
Thanks in advance.

When you crosspost the same question at the same time to different forums you should at least post links to the other forums along with your question to avoid people willing to you help making their work twice or more.

https://stackoverflow.com/questions/61516829/need-some-help-in-formatting-the-out-gridview-display-using-calculated-property

Thanks

You should remove the single quotes you have around the variable $Office365VanityDomain.