Quantcast
Viewing all articles
Browse latest Browse all 2206

New Post: (15,8):UserId: COMexception occured

var iRegTask = v2Folder.RegisterTaskDefinition(Path, definition.v2Def, (int)createType, UserId, password, LogonType, sddl);
I have create a wix setup project and have included a defered custom action, that should install a windows task using the TSMW library.
   using (TaskService ts = new TaskService())
            {
                if (ts.FindTask("MyCustomTask", true) == null)
                {
                    // Create a new task definition and assign properties
                    TaskDefinition td = ts.NewTask();
                    td.RegistrationInfo.Description = "MyCustomTask";

                    td.Settings.DisallowStartIfOnBatteries = false;
                    td.Settings.MultipleInstances = TaskInstancesPolicy.IgnoreNew;
                    td.Settings.WakeToRun = true;
                    td.Settings.StartWhenAvailable = true;
                    //td.Settings.Priority = ProcessPriorityClass.High;
                    td.Principal.RunLevel = TaskRunLevel.Highest;
                    td.Principal.LogonType = TaskLogonType.InteractiveToken;



                    // Create a trigger that will fire the task at this time every other day
                    td.Triggers.Add(new LogonTrigger { });


                    // Create an action that will launch Notepad whenever the trigger fires
                    td.Actions.Add(new ExecAction(pathToApp, null, null));
                    Debugger.Launch();
                    // Register the task in the root folder
                    ts.RootFolder.RegisterTaskDefinition("MyCustomTask", td);


                    //Remove the task we just created
                    //ts.RootFolder.DeleteTask("MyApp");
                }
What I actually want is to run the wix setup package (=MSI) under elevated permissions (Administrator).
When I use an CustomAction configured as "immediate" execute the MSI from an elevated console, then it works, but not on double click.

So I configured the CA as deferred, as I read somewhere, so that it will be automagically be executed in Admin-Mode. The UAC prompt pops up, but I get the above error:

"No mapping between account names and security IDs was done"

Any idea, what's wrong?

Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>