C++ Logon Task Schedule Error: No Mapping Between Account Names and Security Ids Was Done

C++ Logon task schedule Error: No Mapping between account names and security ids was done

I suspect the demo code you have is XP-era, and hasn't been updated to match the Vista/Win7 rules.

I updated the sample to set the LUA settings after setting the logon trigger, and it seems to work:

    hr = pLogonTrigger->put_UserId(_bstr_t(L"DOMAIN\username"));
if (FAILED(hr))
{
printf("\nCannot add user ID to logon trigger: %x", hr);
CoUninitialize();
return 1;
}

//*** NEW**** Set the LUA settings
CComPtr<IPrincipal> pPrincipal;

hr = pTask->get_Principal(&pPrincipal);
if (SUCCEEDED(hr))
{
hr = pPrincipal->put_RunLevel(TASK_RUNLEVEL_LUA);
}
if (SUCCEEDED(hr))
{
hr = pPrincipal->put_GroupId(_bstr_t(L"Builtin\\Administrators"));
}
if (FAILED(hr))
{
printf("\nCannot set runlevel/groupid: %x", hr);
CoUninitialize();
return 1;
}

If you need it to run on XP, then it's likely that the get_Principal call will fail, so let that failure through.

I get the error no mapping between user and security ids was done when I try to deploy a cube

This error occurs when there are users defined in a role that are either not known to the server (i.e. a local account on the machine the project was designed on) or no longer available in the Active Directory. To solve this:

  • Open the cube in BIDS / Visual Studio
  • Go to the Roles node in the Solution Explorer
  • Per role, go to the tab "memberships"
  • Per member defined, check to see if that member still exists in the AD.

In my experience, it's advisable not to use local users in Roles, nor personal accounts. Instead, grant the rights to a role to a group, then add and remove users to that group in the Active Directory as needed.

Error when trying to register a task with task scheduler (Win7)

After spending some time, I've seen that more modifications than just _variant_t(L"S-1-5-32-544") are needed to make this "Logon Trigger Example (C++)" example work.

All the details can be found in this answer.

TaskScheduler is able to execute a service in NT AUTHORITY\SYSTEM account?

TaskScheduler doesn't directly support running services, but you can use a command-line operation to instruct the SCM to start the service (ie, net start "<ServiceName>"). You can use whatever account you want to run the operation, but the account that the service will use is specified in the service's own configuration. The SCM will simply run the service in whatever account has been configured. That will be NT AUTHORITY\SYSTEM by default, if another account is not specified.

Powershell: Set a Scheduled Task to run when user isn't logged in

You need to remove $principal and register the task with a user and password:

Register-ScheduledTask -TaskName $taskname `
-TaskPath "\my\path" `
-Action $action `
-Trigger $trigger `
-User "$env:USERDOMAIN\$env:USERNAME" `
-Password 'P@ssw0rd' `
-Settings $settings


Related Topics



Leave a reply



Submit