CaptainTact commented on
Strings in PowerShell – Replace, compare, concatenate, split, substring 4 years, 4 months ago
Hey Wolfgang! Great article. One question though.
I did a search for all mail-enabled security groups in our Org that we are using as ACLs for Shared Mailboxes. Those group Display Names all end in "-Full" so it's a pretty easy query.
$Full = Get-DistributionGroup -ResultSize Unlimited | Where {$_.Alias -Like "*Full"} | Select Alias
Once I have the alias of those groups, I want to strip off the "Full" portion so that I wind up with the alias of the mailbox it is connected to. I.E., ACL alias is "TestMailboxFull" and is used to regulate access to the shared mailbox with an alias of "TestMailbox".
In order to do that, I ran this command:
$MbxAliases = $Full.Replace("Full","")
However, when I run that, I get the following error:
Method invocation failed because [Selected.Microsoft.Exchange.Data.Directory.Management.DistributionGroup] does not
contain a method named 'Replace'.
At line:1 char:1
+ $Aliases = $Aliases.Replace("Full","")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Replace:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFoundAny ideas as to what I am doing wrong?
CaptainTact became a registered member 4 years, 4 months ago
CaptainTact changed their profile picture 4 years, 4 months ago
CaptainTact's profile was updated 4 years, 4 months ago