When my program installs using msiexec.exe it adds a task to the task scheduler to check if it’s running and start up if it’s not (it’s a kiosk scenario).
WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent();
string user = windowsIdentity.Name
Unfortunately my task is being added as SYSTEM which when run won’t be able to access the UserEnvironment. Does anyone know of a way to get the user who originiated the command rather than the user msiexec.exe is running as?
If you need check it during installation process – you can use custom action on VBScript, for example, which checks logged users with help of WMI.