I am using the following Powershell script for updating User Information Lsit in SP2013 environment. I am a member of Administrators group and also Site collection administrator.
$Site = Get-SPSite "http://ift.tt/1iWOj68"
$web = $Site.RootWeb
$list = $web.Lists["User Information List"]
$query = New-Object Microsoft.SharePoint.SPQuery
$query.Query = "<Where><Contains><FieldRef Name='Name' /><Value Type='Text'>Amit.Tyagi@something.com</Value></Contains></Where>"
foreach ($item in $list.GetItems($query))
{
$item["Department"] = "Marketing Department"
$item.SystemUpdate()
"Name = " + $item["Name"] + " :: Department = " + $item["Department"]
}
The script is running successfully on DEV and TEST environments. But on my production environment i am getting following error for $item.SystemUpdate()
statement,
Exception calling "SystemUpdate" with "0" argument(s): "0x80070005" At D:\Solution\UserProfileUpdation\testscript.ps1:12 char:9 + $item.SystemUpdate() + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : UnauthorizedAccessException
0 commentaires:
Enregistrer un commentaire