简体   繁体   中英

Remove SMTP: from primary email address

How do I remove SMTP: from this statement, I want to parse this from the returning email address I have tried several methods and it always makes the entire field return blank.

@{Name = "PrimaryEmail"; Expression = { $_.ProxyAddresses.Where( { $_.StartsWith( 'SMTP:') } ) } }

You can use the -creplace operator for this.

@{ Name = "PrimaryEmail"
   Expression = { $_.ProxyAddresses.Where( { $_.StartsWith( 'SMTP:') } ) -creplace '^SMTP:'}
}

-creplace is a case-sensitive version of replace . It works with array or string output. ^ matches the beginning of the current string. SMTP: is a literal match.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM