Reputation: 17353
If yes, please give an example.
UPDATE:
I have a PowerShell script that iterates through all site collections within selected Web application and changes the siteCollection.Audit.AuditFlags
property. It works fine on my development machine, but the siteCollection.Audit.Update()
command fails with Access is denied error on the production server, even though I am trying to run it as a user who is a farm administrator.
Upvotes: 2
Views: 6407
Reputation: 1701
Yes, it can.
[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({
$site = get-spsite "http://localhost/nonfarmadminsitecollection";
});
Be careful with that. Since you are impersonating the process account, you lose information about the user in the audit trails.
Upvotes: 9
Reputation: 52430
RunWithElevatedPrivs uses the application pool user on regular web apps, not farm admin. If the elevation happens on central administration, then it's a farm admin account. I assume you are doing this on regular webapps, so launch powershell as the app pool acount.
Upvotes: 4
Reputation: 6988
Run powershell as an administrator or as your webapp application pool user.
Upvotes: 3