Exchange Server 2013 Hiding Membership in Automated DL


The below Exchange 2013 PowerShell script used to hide the membership in the distribution list. Although it can be done manual method but when it comes to change on large number of DL the script plays important to make our job easier.

Exchange 2013 Hiding Members

$OutputFile = “C:\Temp\Raji\DL\out.txt”

$Input = Get-Content “C:\Temp\Raji\DL\DL.txt” 

ForEach ($DLName in $Input)

{

Add-Content $OutputFile “Before Modification of DL”

$Output = Get-ADGroup $DLName -Properties DisplayName,hideDLMembership | select displayname,hideDLMembership | FT -Autosize

Write-Output $Output

$Output | Out-File -filePath $OutputFile -append -encoding ASCII 

Add-Content $OutputFile “After Modification of DL”

Set-ADGroup $DLName -Replace @{hidedlmembership=$TRUE} -Verbose

$Output1 = Get-ADGroup $DLName -Properties DisplayName,hideDLMembership | select displayname,hideDLMembership | FT -Autosize

Write-Output $Output1

$Output1 | Out-File -filePath $OutputFile -append -encoding ASCII

}

 

 

$OutputFile = “C:\Temp\Raji\DL\out.txt”

$Input = Get-Content “C:\Temp\Raji\DL\DL.txt”

ForEach ($DLName in $Input)

{

Add-Content $OutputFile “Deny Everyone Permission in the DL”

Add-ADPermission $DLName -user “Everyone” -Deny -AccessRights ReadProperty -Properties Member -verbose

$Output2 = Get-ADPermission $DLName | where {$_.Properties -like “Member”} | fl

Write-Output $Output2

$Output2 | Out-File -filePath $OutputFile -append -encoding ASCII 

}

Advertisements

About Raji Subramanian

Nothing great to say about me...Just want to share my knowledge for others that will be useful at any moment of time when they stuck in critical issue....
This entry was posted in Exchange 2013 SP1, Exchange Management Powershell Command, Script, Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s