How to update the modified by using power shell

Advertisement
In this example I want to show how to update the modify by and modified date using PowerShell.
Sometimes it may happen that exiting item or items we need to update with the user name instead of our name, for that we can achieve using power shell easily.

Here I am updating the Last modified name and the date with name for a particular items based on the item ID.

$web = Get-SPWeb http://dotnetsharepoint.com/sites/dotnet/sharepoint2013
$list = $web.lists["UpdateModified"]
#23 is my item id,i am update for a particular item only
$item = $list.items.getitembyid(23)
$username = $Web.EnsureUser(domain/username)
$item["Editor"] = $username
$item["Modified"] = "7/17/2015 8:00 AM"
$item.Update()
$list.Update()
$web.Dispose()

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM
Advertisements
SHARE

Lakshmi Tulasi Jasti

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a comment