Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Monday, April 20, 2020

Technical Post - List Users of Active Directory Group

A small PowerShell script to list users in a specific Active Directory group

get-adgroup groupname | get-adgroupmember | sort name | % {$}

groupname = The name of the AD group you wish to look at.

Monday, December 08, 2014

Techie Tip : Powershell script for deleting emails by keyword for Exchange 2013

Another post meant for me because I am so forgetful, but it may be useful for others if they come across this.

OK, not one I need to use very often, but here is a quick script for when you need to delete an email with a specific keyword in the subject from multiple mailboxes

Write-Host ""
Write-Host "The following script deletes emails from a named user/mailbox"
Write-Host "containing a specified string in the Subject of the email"
Write-Host ""

Write-Host "Please enter a name (* wildcards ARE ALLOWED)"
$name = Read-Host '>>'

Write-Host ""
Write-Host "Please enter a SUBJECT' keyword (* wildcards ARE ALLOWED)"
$keyword = Read-Host '>>'

Search-Mailbox -identity $name -SearchQuery "Subject:'$keyword'" -deletecontent