Skip to content

Instantly share code, notes, and snippets.

@sabique
Last active August 20, 2016 08:45
Show Gist options
  • Save sabique/9b0aa1c24a8994e8f16d4434d89eb405 to your computer and use it in GitHub Desktop.
Save sabique/9b0aa1c24a8994e8f16d4434d89eb405 to your computer and use it in GitHub Desktop.
SharePoint 2010 : Update the value of a column in library
cls
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
Add-PSSnapin Microsoft.SharePoint.PowerShell;
}
$sourceWebURL = "http://sp2010/sites/"
$sourceListName = "Library Name"
$spSourceWeb = Get-SPWeb $sourceWebURL
$spSourceList = $spSourceWeb.Lists[$sourceListName]
$spSourceItems = $spSourceList.Items | where {$_['Title'] -like "*Lorem*"}
$exdate = '{0:M/dd/yyyy hh:mm:ss tt}' -f (Get-Date)
$spSourceItems | ForEach-Object {
$_['Created'] = $exdate
$_.update()
}
@sabique
Copy link
Author

sabique commented Aug 20, 2016

Line 6 : Write the URL of your site.
Line 7 : Write the name of your Library
Line 11 : Write the condition for your script.
Line 15 : Name of the columns you want to update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment