How to: Update item or document properties without changing the Modified or Modified By fields using SharePoint Powershell

Today I want to provide a useful SharePoint PowerShell script that allows you to update properties of a list item or a document without changing the Modified or Modified by fields and without firing any event receiver or workflow.

In this example I have only changed the title of the first item in my list.

# open web
$web = Get-SPWeb http://yoursite
# get list
$list = $web.Lists["Your List"]
# get item
$item = $list.GetItemById(1)
 
# disable event firing 
$myAss = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$type = $myAss.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);
 
# change properties
$item["Title"] = "New Title"
 
# update item (without changing the Modified or Modified By fields)
$item.SystemUpdate($false)
 
# enable event firing
$prop.SetValue($null, $false, $null);
# open web
$web = Get-SPWeb http://yoursite
# get list
$list = $web.Lists["Your List"]
# get item
$item = $list.GetItemById(1)

# disable event firing 
$myAss = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$type = $myAss.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);

# change properties
$item["Title"] = "New Title"

# update item (without changing the Modified or Modified By fields)
$item.SystemUpdate($false)

# enable event firing
$prop.SetValue($null, $false, $null);

It’s important to set EventFiringDisabled to true if you don’t want event receivers or workflows to be executed. To do this I used reflection to set the internal static property of the SPEventManager class.

It is also important to use SystemUpdate instead of Update because this updates the database with changes that are made to the list item without changing the Modified or Modified By fields.