I am using the following Powershell script for updating User Information List in SP2013 environment. I am a member of Administrators group and also Site collection administrator.
$Site = Get-SPSite "https://www.something.com"
$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'>[email protected]</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
UnauthorizedAccessException
. Are you able to manually modify the list from the Browser using the same account?