c# Programming Glossary: tokenduplicate
Run Powershell-Script from C# Application http://stackoverflow.com/questions/11120452/run-powershell-script-from-c-sharp-application tempWindowsIdentity null IntPtr token IntPtr.Zero IntPtr tokenDuplicate IntPtr.Zero try if RevertToSelf if LogonUser userName .. ref token 0 if DuplicateToken token 2 ref tokenDuplicate 0 tempWindowsIdentity new WindowsIdentity tokenDuplicate.. 0 tempWindowsIdentity new WindowsIdentity tokenDuplicate impersonationContext tempWindowsIdentity.Impersonate else..
How do you impersonate an Active Directory user in Powershell? http://stackoverflow.com/questions/11806/how-do-you-impersonate-an-active-directory-user-in-powershell tempWindowsIdentity null IntPtr token IntPtr.Zero IntPtr tokenDuplicate IntPtr.Zero try if RevertToSelf if LogonUser userName .. ref token 0 if DuplicateToken token 2 ref tokenDuplicate 0 tempWindowsIdentity new WindowsIdentity tokenDuplicate.. 0 tempWindowsIdentity new WindowsIdentity tokenDuplicate impersonationContext tempWindowsIdentity.Impersonate else..
C#: How to logon to a share when using DirectoryInfo http://stackoverflow.com/questions/1232120/c-how-to-logon-to-a-share-when-using-directoryinfo tempWindowsIdentity null IntPtr token IntPtr.Zero IntPtr tokenDuplicate IntPtr.Zero functionReturnValue false if RevertToSelf if LogonUserA.. ref token 0 if DuplicateToken token 2 ref tokenDuplicate 0 tempWindowsIdentity new WindowsIdentity tokenDuplicate impersonationContext.. tokenDuplicate 0 tempWindowsIdentity new WindowsIdentity tokenDuplicate impersonationContext tempWindowsIdentity.Impersonate if impersonationContext..
How to change folders permission to the current user by using admin credentials? http://stackoverflow.com/questions/18580419/how-to-change-folders-permission-to-the-current-user-by-using-admin-credentials tempWindowsIdentity IntPtr token IntPtr.Zero IntPtr tokenDuplicate IntPtr.Zero if RevertToSelf if LogonUser userName domain password.. DEFAULT_NUMBER ref token 0 if DuplicateToken token 2 ref tokenDuplicate 0 tempWindowsIdentity new WindowsIdentity tokenDuplicate.. 0 tempWindowsIdentity new WindowsIdentity tokenDuplicate impersonationContext tempWindowsIdentity.Impersonate if impersonationContext..
Accessing Password Protected Network Drives in Windows in C#? http://stackoverflow.com/questions/2563724/accessing-password-protected-network-drives-in-windows-in-c out token throw new Win32Exception try IntPtr tokenDuplicate if NativeMethods.DuplicateToken token NativeMethods.SecurityImpersonationLevel.Impersonation.. NativeMethods.SecurityImpersonationLevel.Impersonation out tokenDuplicate throw new Win32Exception try using WindowsImpersonationContext.. impersonationContext new WindowsIdentity tokenDuplicate .Impersonate Do stuff with your share here. impersonationContext.Undo..
|