Skip to content

Instantly share code, notes, and snippets.

View chintakchhapia's full-sized avatar

Chintak Chhapia chintakchhapia

  • Ahemdabad, India.
View GitHub Profile
@chintakchhapia
chintakchhapia / delete email by office 365 admin.ps1
Created October 31, 2025 10:26
Office 365 admin - delete email sent to lot of users using PowerShell
Import-Module ExchangeOnlineManagement
#EnableSearchOnlySession switch is only availabe in ExchangeOnlineManagement version 3.9.0
Connect-IPPSSession -UserPrincipalName <<adminEmailAddress>> -EnableSearchOnlySession
$Search=New-ComplianceSearch -Name "Remove Email Sent on <<Date>>" -ExchangeLocation All -ContentMatchQuery '(Received:<<FromDate>>..<<ToDate>>) AND (Subject:"<<Subject>>")'
Start-ComplianceSearch -Identity $Search.Identity
#run this after sometime
@chintakchhapia
chintakchhapia / sp_BlitzIndex.sql
Last active February 8, 2017 12:51
sp_BlitzIndex with option to script ignore_dup_key index setting with fixed issue #702
SET ANSI_NULLS ON;
SET ANSI_PADDING ON;
SET ANSI_WARNINGS ON;
SET ARITHABORT ON;
SET CONCAT_NULL_YIELDS_NULL ON;
SET QUOTED_IDENTIFIER ON;
SET STATISTICS IO OFF;
SET STATISTICS TIME OFF;
GO