When I try to perform Directory.Move()
I get error
System.IO.IOException ... Access Denied
Steps to reproduce:
PsExec.exe -s -d -i
which could assign system privilege to my program. (When running System.Security.Principal.WindowsIdentity.GetCurrent().Name
gives NT AUTHORITY\\SYSTEM
)ImpersonateLoggedOnUser()
- no error returnedDirectory.Move(myfolderAtProgramData,myfolderAtProgramData+"_")
System.IO.IOException
- 'Access Denied'If LogonUser with LOGON32_LOGON_NEW_CREDENTIALS then it works. Why??
Below are references for my implementation:
Environment:
Win10 Pro 64bit ,EN ,Visual Studio 2013 , .Net4.0 , c#
A folder at ProgramData (allow modification only with administrator privilege)