SOLVED

Hide O365 mail contact from GAL using CSV and powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-917264%22%20slang%3D%22en-US%22%3EHide%20O365%20mail%20contact%20from%20GAL%20using%20CSV%20and%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-917264%22%20slang%3D%22en-US%22%3E%3CP%3EHow%20to%20Hide%20O365%20mail%20contact%20from%20GAL%20using%20CSV%20list%20and%20powershell%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Etried%20below%20but%20is%20looking%20for%20identity%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EImport-Csv%20c%3A%5Ccsv%5Cdisable.csv%7C%25%7BSet-MailContact%20-Name%20%24_.Name%20-HiddenFromAddressListsEnabled%20%24true%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20850px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F138110i977921A9AA54D519%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture.JPG%22%20title%3D%22Capture.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-917264%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Super Contributor

How to Hide O365 mail contact from GAL using CSV list and powershell

 

tried below but is looking for identity

 

Import-Csv c:\csv\disable.csv|%{Set-MailContact -Name $_.Name -HiddenFromAddressListsEnabled $true}

 

Capture.JPG

1 Reply
Highlighted
Best Response confirmed by Marvin Oco (Super Contributor)
Solution

That's because you are using the -Name parameter, which is to change the Name attribute of the user, not to designate him as a subject to the Set-MailContact cmdlet. Use this instead:

 

Import-Csv c:\csv\disable.csv|%{Set-MailContact -Identity $_.Name -HiddenFromAddressListsEnabled $true}

 

And make sure you have a column "Name" in the CSV file.