magritton
7/12/2016 - 5:53 PM

SharePoint Event Receiver powershell scripts

SharePoint Event Receiver powershell scripts

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

 #Get the web
 $Web = Get-SPWeb "https://xxxx"

 #Get the Target List
 $List = $Web.Lists["CatsItems"]

 #Retrieve all event receivers associated with the list
 $List.EventReceivers | Select Id, Type, Assembly, Class
  Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 #Get the web
 $Web = Get-SPWeb "http://spsvde001/tools/cats"

 #Get the Target List
 $List = $Web.Lists["Cats Items"]

 #Retrieve all event receivers associated with the list
 ##$List.EventReceivers #| Select Id, Type, Assembly, Class| out-file
 $List.EventReceivers #| out-file C:\temp\temp.txt
 $r = $List.EventReceivers | Where {$_.ID -eq "133f853e-a53c-47ff-bbae-5ff80c93da6e"}
 $r.Delete()