User: A who is an ADMIN (or has rights) runs C#-IIS app, which, runs PowerShell (through new PowerShell.Create(), Script() and ps.BeginInvoke).
PS script does a Copy-Item from one local folder to a networked folder (user has rights). In fact, for testing, I set 'Everyone' to have rights (so it's likely not IIS_IUSRS either).
Result: "Access is denied" error.
How can I solve this?
Background:
- Cannot explicitly run the powershell exe elevated because I need to capture verbose and other output streams asynchronously.
- Just for fun - tried the using (new Impersonator(...)) {...}. But as expected, I'm already running as myself/admin - no change.
- When I dump the username (Write-Verbose "Running as $env:username") - I get the machine name (with dollar sign following) - if that helps.
Thanks,