Link to home
Start Free TrialLog in
Avatar of AD1080
AD1080

asked on

Add Filter to For Each Powershell Script

Hi,

I need assistance to add a filter to the following powershell script, to allow me to test only a few email addresses, before running it on our entire directory.   We can use "where the mailbox name contains "john"

$Mailboxes = get-mailbox -resultsize "unlimited"
foreach ($Mailbox in $Mailboxes) {
Set-Mailbox -Identity $Mailbox -CustomAttribute1 $Mailbox.Office
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AD1080
AD1080

ASKER

Thanks again.
Not a problem, glad to help!

Will.