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
How to Determine the Value of Socket Listen() Backlog Parameter
How to Get at the Exception Information When Using Minidumpwritedump Out-Of-Process
What Is the Cin Analougus of Scanf Formatted Input
Clang-Omp in Xcode Under El Capitan
What Exactly Is a Namespace and Why Is It Necessary
Xcode 3.2.1 and C++ String Fails!
How to Use the Ansi Escape Code for Outputting Colored Text on Console
How to Initialize an Array of Struct in C++
How to Implement Readlink to Find the Path
Inconsistent Use of Const Qualifier Between Declaration and Definition
Wrap Overloaded Function via Std::Function
Mapping Elements in 2D Upper Triangle and Lower Triangle to Linear Structure
How to Implement an Function Equivalent to Bwmorph Matlab Function in Opencv