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

**URL:** <https://forums.powershell.org/t/how-to-format-the-calculated-property-column-to-remove-specific-string-pattern/14294>\
**Category:** PowerShell Help\
**Created:** [April 30, 2020, 2:10am UTC](https://forums.powershell.org/t/how-to-format-the-calculated-property-column-to-remove-specific-string-pattern/14294 "2020-04-30T02:10:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![albertwt](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/albertwt/32/2550_2.png) [@albertwt](https://forums.powershell.org/u/albertwt)\
**Post date:** [April 30, 2020, 2:10am UTC](https://forums.powershell.org/t/how-to-format-the-calculated-property-column-to-remove-specific-string-pattern/14294/1 "2020-04-30T02:10:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [April 30, 2020, 2:26am UTC](https://forums.powershell.org/t/how-to-format-the-calculated-property-column-to-remove-specific-string-pattern/14294/2 "2020-04-30T02:26:00Z")

</div>

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](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**.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:30pm UTC](https://forums.powershell.org/t/how-to-format-the-calculated-property-column-to-remove-specific-string-pattern/14294/3 "2024-05-16T20:30:09Z")

</div>


