A small PowerShell script to list users in a specific Active Directory group
get-adgroup groupname | get-adgroupmember | sort name | % {$_.name}
groupname = The name of the AD group you wish to look at.
Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts
Monday, April 20, 2020
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
cls
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 '>>'
$name
Write-Host ""
Write-Host "Please enter a SUBJECT' keyword (* wildcards ARE ALLOWED)"
$keyword = Read-Host '>>'
$keyword
Search-Mailbox -identity $name -SearchQuery "Subject:'$keyword'" -deletecontent
exit
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
cls
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 '>>'
$name
Write-Host ""
Write-Host "Please enter a SUBJECT' keyword (* wildcards ARE ALLOWED)"
$keyword = Read-Host '>>'
$keyword
Search-Mailbox -identity $name -SearchQuery "Subject:'$keyword'" -deletecontent
exit
Subscribe to:
Posts (Atom)