Question: How can I call `DisableEventFiring` using PowerShell?

C# code like this :

```
Type typeInfo = typeof(SPEventReceiverBase); 
MethodInfo disable = typeInfo.GetMethod("DisableEventFiring", BindingFlags.Instance | BindingFlags.NonPublic);
SPEventReceiverBase receiver = new SPEventReceiverBase();
 disable.Invoke(receiver, null);

```

I need do something like this using PS

Answer: 
Here's how I did it but in most situations it is best not to disable event firing outside the event handlier/receiver:

```
$web = Get-SPWeb -Identity http://yoursharepointweb #FILL IN WITH YOUR WEB URL
$list = $web.Lists["YOUR LIST"] #THE LIST NAME FOR YOUR LIST
$item = $list.GetItemById(YOUR NUMERIC LIST ITEM ID) #THE ITEM ID
$assembly = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$type = $assembly.GetType("Microsoft.SharePoint.SPEventManager");
$prop = $type.GetProperty([string]"EventFiringDisabled",[System.Reflection.BindingFlags] ([System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Static)); 
$prop.SetValue($null, $true, $null); #SET EVENT FIRING DISABLED. 
$item["YOUR COLUMN NAME"]= "YOUR VALUE"
$item.SystemUpdate($false)
$prop.SetValue($null, $false, $null); #SET EVENT FIRING ENABLED.

```

I use the above code in a situation where a workflow task is assigned to a "blank" user i.e. sometimes a user has no permissions on a SharePoint site but they are assigned a task by the initiator of the workflow. In this case the task is assigned to blank and the email alert is sent out but the Assigned To field on the task item remains blank.
You can call this function only from inside an event receiver but not via powershell.

If you want to prevent a event receiver from being fired, you can use a power shell script to remove it. <http://blogs.msdn.com/b/sharepoint_bar__grill/archive/2011/12/12/10151733.aspx>

Another option is to SharePoint Manager 2010 to remove the Event receiver. <http://spm.codeplex.com>