There is an MSI custom action that would launch an external process. However, on Windows 7 (maybe, Vista too) the custom action, which runs under the LocalSystem account, does NOT have SE_BACKUP_NAME
privilege. The external process I am launching requires this privilege at some stage. However, it doesn't get the privilege as the parent (running MSI custom action) doesn't have it. This is a known issue on Vista/7 as Microsoft has removed this privilege on the msiexec.exe
process if custom action (say MSI) runs as a Local System account. IMO, the question doesn't need more information around MSI.
I have tried combinations of LogonUser
, SetTokenInformation
(to add a new privilege), set and update linked token, DuplicateTokenEx
, and eventually CreateProcessAsUser
. However, the created process will never have the backup privilege enabled no matter how I try.
My simple question is:
- How to run the external process with all the default privileges the Local System account would have?
Why does Windows sticks to the restricted token?
I got to know that once the token is created, no more privileges can be added. SetTokenInformation
will fail. I wonder how to add the privilege to a token (which isn't used yet)!
Related:
- https://social.msdn.microsoft.com/Forums/en-US/4a18edd5-88fb-464a-8b57-5c9ec71170dd/windows-installer-45-and-sebackupprivilege
- https://social.msdn.microsoft.com/Forums/en-US/edbd7f01-aeb2-45ac-9264-9c256ee4b314/how-to-get-sebackupprivilege-in-a-deferred-custom-action-exe
- CreateProcessAsUser with elevated privileges
- How to call LogonUser() to get a non-restricted full token inside a Windows Service with UAC enabled?