Powershell to reset Hide from Gal list flag

gd6627
gd6627 used Ask the Experts™
on
I need to run a PS script that will grab a csv list of users samaccount name and reset the MsEchHideFromAddressList Flag to True
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Michael B. SmithManaging Consultant

Commented:
$csv = Import-Csv <filename>
$csv |% { Set-Mailbox -Identity $_.samaccountname -HiddenFromAddressListsEnabled $false }

Open in new window

System Engineer
Commented:
Try the below script (make sure to change the filename and location accordingly)

Import-Csv 'C:\Hide_Mailboxes.csv' | ForEach-Object {
$sam = $_."SamAccountName"
Set-Mailbox -Identity $sam -HiddenFromAddressListsEnabled $true
}

Author

Commented:
Thank  you gentleman
Gopi RajuSystem Engineer

Commented:
You are welcome

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial