-Replace with the select-object

Im trying to replace text within the select-object

[pre]

Get-MsolUser -all |Where-Object {$.islicensed -eq $true} | Select-Object signinname,licenses,@{Name=“test”; E={(‘licenses’ -replace '{reseller-account:O365’,‘’)}}
[/pre]

This isnt working, anyone have a better solution ?

You have to specify the property you want to use for the replacement.

@{Name=“test”; E={($.licenses -replace '{reseller-account:O365’,")}

… if I got it right :wink:

[quote quote=174553][/quote]
Almost :slight_smile:

now i get the following result

Test@test.nl {reseller-account:O365_BUSINESS_PREMIUM} Microsoft.Online.Administration.UserLicense

instead of

Test@test.nl {reseller-account:O365_BUSINESS_PREMIUM} BUSINESS_PREMIUM

 

Well what a way for microsoft to put another array in there

 

Get-MsolUser -all |Where-Object {$.islicensed -eq $true} | Select-Object signinname,licenses,@{Name=“test”; E={($.licenses.accountskuid -replace ‘reseller-account:O365_’,‘’)}}

is the solution.

Thanx @Olaf for pointing me in the right direction