Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does SPSecurity.RunWithElevatedPrivileges do anything in a console app?

From what I have gleaned from reflector, RunWithElevatedPriveleges simply reverts the current thread identity to the base (non-impersonated) identity. This makes perfect sense in the case of code running inside the WSS application pool, since the base service account is a super-user. Does it have any effect when running in an external (console or service) application, when no impersonation exists? I'm guessing not, but I'd like to know for sure. I've seen varying opinions on this from googling.

like image 918
jlew Avatar asked Mar 31 '26 00:03

jlew


1 Answers

Normally Runwithelevatedprivileges will get your code running as the app pool identity, but it doesn't work from the console. What we've done in this case is either use runas or a set the identity of a scheduled task to the same account as the app pool identity.

like image 188
Eugene Katz Avatar answered Apr 02 '26 22:04

Eugene Katz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!