Can RunWithElevatedPrivileges be used in a PowerShell script?
问题 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. 回答1: Run powershell as an administrator or as your webapp application pool