Hello ChatGPT. I'm on Windows 10, Task Scheduler and I'm trying to run an application when "Run only when user is logged in" but I need to add two users
Assistant
In Windows Task Scheduler, a task can only be assigned to a single user at a time when you choose the "Run only when user is logged on" option. However, you can work around this limitation by creating separate tasks for each user account that needs to run the application. Here's how you can do that:
Steps to Create a Scheduled Task for Each User
:
User
Well I'm launching the app through a link
Assistant
If you are launching an application through a link (for example, a shortcut or a URL), you can still follow a similar approach in the Task Scheduler. When setting up your scheduled tasks for each user, you will specify the shortcut or the URL link as the program to run. Here’s how to do it:
User
im doing this for xample for shortcuit link to bypass UAC C:\Windows\System32\schtasks.exe /run /tn "UAC pass\FileRecovery - Active File Recovery"
Assistant
User
So its a duplicate task?
Assistant
Yes, in the context of Windows Task Scheduler, creating two separate tasks for different user accounts to run the same command is essentially creating . Each task is assigned to a specific user account and is configured with the same actions and triggers, but they operate independently based on the user who logs into the system.
User
So in conclusion, for each app it would be two task schedualers
Assistant
Yes, in conclusion, if you want to run the same application or command for two different user accounts without UAC prompts in Windows Task Scheduler, you need to create two separate scheduled tasks, one for each user account. Here’s a concise overview of the process:
Summary Steps for Creating Scheduled Tasks for Multiple Users
User
wrong, if both are administrators?
Assistant
I apologize for any confusion. If both users are administrators, the situation can be simplified since administrative users generally have more permissions and can execute certain tasks without triggering User Account Control (UAC) prompts. However, there are still considerations to be aware of regarding scheduled tasks:
Open Task Scheduler
Press Windows + R to open the Run dialog.
Type taskschd.msc and press Enter.
Create a New Task:
In the Task Scheduler, click on "Create Task" on the right pane.
General Settings:
In the "General" tab, enter a name for the task.
Choose "Run only when user is logged on".
Important: In the "Security options" section, select the first user account from the drop-down menu (you will create a separate task for the second user later).
Trigger Settings:
Navigate to the "Triggers" tab.
Click "New..." to create a new trigger, selecting the appropriate conditions (such as "At log on" of the user).
Action Settings:
Go to the "Actions" tab.
Click "New..." and select "Start a program".
Browse to the application you want to run or enter the path manually.
Conditions and Settings:
Configure any additional settings in the "Conditions" and "Settings" tabs as needed.
Save the Task:
Click "OK" to save and create the task.
Repeat for the Second User
Create the Second Task:
Repeat steps 2 to 7, but this time select the second user account in the "General" tab.
Verification
Testing:
Log in as each user to verify that the application starts as expected when they log on.
Additional Tips
If the application requires specific permissions, ensure that both user accounts have the necessary permissions.
Consider defining user-specific settings or configurations if your application requires customization per user.
By following these steps, you will have separate tasks for each user that launches the desired application when they log in to their respective accounts.
Steps to Create a Scheduled Task to Launch an App Through a Link
Open Task Scheduler:
Press Windows + R, type taskschd.msc, and press Enter.
Create a New Task:
In the Task Scheduler, click on "Create Task" on the right pane.
General Settings:
In the "General" tab, enter a name for the task.
Choose "Run only when user is logged on".
In the "Security options" section, select the first user account from the drop-down menu.
Trigger Settings:
Navigate to the "Triggers" tab.
Click "New..." to create a new trigger.
Select "At log on" and specify the user (if it's not already defined).
Action Settings:
Go to the "Actions" tab.
Click "New..." and select "Start a program".
For a Shortcut:
In the "Program/script" field, enter the path to the link's executable if it is a direct shortcut.
If you have a .url file, provide the path to that file.
If it's a web URL, you may want to use a web browser. For example:
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe for Chrome, or
C:\Program Files\Mozilla Firefox\firefox.exe for Firefox.
In the "Add arguments (optional)" field, enter the URL (e.g., http://example.com).
Conditions and Settings:
Configure any additional settings in the "Conditions" and "Settings" tabs as needed.
Save the Task:
Click "OK" to save and create the task.
Create the Second Task for the Other User
Repeat for the Second User:
Repeat steps 2 to 7 for the second user account, ensuring you choose their account in the "General" tab.
Verifying
Test Each Task:
Log in as each user to verify that the application launches as expected when they log in.
Additional Notes
If the link or application requires specific permissions, ensure both user accounts have the necessary access.
If the link points to a web application, ensure that the appropriate browser is installed and can be launched by the user.
By following these steps, you will have scheduled tasks for each user that will launch the desired application or link when they log into their accounts.
If you're trying to set up a Task Scheduler task to run a shortcut or application that bypasses User Account Control (UAC) for different users in Windows 10, you can use the schtasks.exe command as you mentioned. Below are the detailed steps to create a scheduled task that uses the command you provided, and ensure it runs for each user account:
Steps to Create the Task in Task Scheduler
Open Task Scheduler:
Press Windows + R, type taskschd.msc, and press Enter.
Create a New Task:
In the Task Scheduler, click "Create Task" from the right pane.
General Settings:
In the "General" tab, give your task a name (e.g., "Launch File Recovery").
Make sure to select "Run only when user is logged on".
In the "Security options" section, select the first user account from the drop-down menu.
Check the option "Do not store password. The task will only have access to local computer resources."
Trigger Settings:
Go to the "Triggers" tab.
Click "New..." and choose "At log on" for the trigger type.
Set the user to which you want this task to apply (first user).
Action Settings:
Go to the "Actions" tab.
Click "New...", and choose "Start a program".
In the "Program/script" field, enter the command to run the existing task:
C:\Windows\System32\schtasks.exe
In the "Add arguments (optional)" field, enter:
/run /tn "UAC pass\FileRecovery - Active File Recovery"
Leave the "Start in (optional)" field blank.
Conditions and Settings:
Configure any additional settings in the "Conditions" and "Settings" tabs as needed.
Save the Task:
Click "OK" to create the task.
Repeat for the Second User
Create the Second Task:
Repeat steps 2 to 7 for the second user account, selecting their account in the "General" tab this time.
Testing
Verification:
Log in as each user to verify that the Active File Recovery application launches as expected without prompting UAC.
Additional Considerations
Permissions: Ensure that both user accounts have appropriate permissions to run the schtasks command and access the scheduled task you're trying to invoke.
Security: Bypassing UAC can pose security risks. Make sure you're aware of the implications and use this approach cautiously.
UAC Bypass: If the scheduled task itself doesn’t require administrative privileges to run, it should succeed without elevation. However, if direct execution prompts UAC, this scheduling method will help you bypass that.
By following these steps, you should be able to set up a task that runs the specified command for both user accounts when they log in, effectively bypassing UAC for launching the application.
duplicate tasks
Key Points About Duplicate Tasks:
Separate User Context: Each task runs under its assigned user account. The task scheduled for User A won't interfere with the task for User B, even though they perform the same action.
Identical Configuration: Both tasks will have the same triggers (e.g., "At log on") and the same action (e.g., running the schtasks.exe command to trigger the specified task), but they will be associated with different user credentials.
Easier Management: If you need to change the settings (e.g., modifying when the task triggers or what it does), you can do so for each user account independently without affecting the other.
No Cross-User Functionality: Windows Task Scheduler does not allow one scheduled task to run under the context of a specific user without being logged in. That’s why you need two separate tasks for different users in your case.
Steps Recap for Creating Duplicate Tasks
In summary, if you need to run the command for two different user accounts:
Create a Task for User A:
Configure and save the task as described in previous steps.
Create a Task for User B:
Repeat the process and configure it for User B with the same settings.
Manual Configuration of the Scheduled Task
If the specific task has already been created and configured properly for one user, you could also choose to manually export and import the task for the other user, but you will still need to adjust the owner (user) in the XML file accordingly.
Example: Exporting and Importing a Task
Right-click the Task and select "Export..." to save the task as an XML file.
Edit the XML File to change the <UserId> to the second user's account.
Open Task Scheduler and select "Import Task..." to bring the modified configuration in for the new user.
Conclusion
Creating duplicate tasks in Task Scheduler is the standard procedure when you want the same action to happen for different user accounts. This allows each user to have their own configurations while still achieving the overall goal of running the application or link without UAC prompts.
Create Task for User A:
Open Task Scheduler.
Create a new task and configure it to run only when User A is logged on.
Set up the trigger (e.g., "At log on" for User A).
Define the action (e.g., run a command or application path).
Save the task.
Create Task for User B:
Repeat the same process as above for User B.
Change the user context to ensure it runs under User B's account while keeping the trigger and action the same.
Key Points to Remember
Separate Context: Each task runs under its own user account. Configuring separate tasks allows both accounts to independently execute the application or command when they log in.
Manage Individually: You can manage (edit, disable, delete) each task independently according to the needs of each user.
Duplicate Configuration: While the tasks are duplicates in what they do, they are essential for providing the same capabilities to different users.
Billing and UAC Consideration: This method helps bypass UAC while providing necessary access to applications without escalating privileges.
Practical Application
If you have multiple applications or commands to run for these users, you would create two tasks for each application, resulting in duplicate pairs of tasks based on the number of user accounts and applications you need to manage. For instance, if you have three applications and two users, you would end up with six scheduled tasks:
Task 1 for User A (Application 1)
Task 2 for User A (Application 2)
Task 3 for User A (Application 3)
Task 4 for User B (Application 1)
Task 5 for User B (Application 2)
Task 6 for User B (Application 3)
This way, each user can utilize the applications or commands without encountering UAC prompts when they log in.
Key Points for Admin Users
UAC Behavior: Even when both users are administrators, UAC can still trigger under certain conditions, especially for tasks that require elevated privileges. If the scheduled task is set to run with the highest privileges, it may still prompt for elevation.
Single Task with Multiple Users: In cases where the same application needs to run for multiple administrators, it's possible to create a single task that can be run by either user. For example, you can set the task to run regardless of the user logged on, although this might require running the task with the highest privileges.
Creating a Single Task (Optional):
If you know both users will need access to the same functionality and they are both administrators, you can create one task with the following settings:
In the "General" section, check "Run with highest privileges".
Set the "Security options" to either of the administrator accounts or "Run whether user is logged on or not".
Recommended Approach for Administrators
Create a Scheduled Task for Both Admins:
Open Task Scheduler.
Create a new task, ensuring it is set to "Run with highest privileges".
If you choose "Run whether the user is logged on or not", you may still need to provide credentials when executing it.
Set Triggers and Actions:
Set up the appropriate triggers (like "At log on") as needed.
Define the action to run the desired application or command.
Conclusion for Admin Users
Single Task for Both: If both users are administrators and share the same task requirements (e.g., running the same application), you can create a single scheduled task that they can both invoke, minimizing duplication.
Manage Privilege Levels: Ensure that the task is configured properly to execute with the necessary privileges so as to minimize any UAC prompts.
This simplifies your configuration while still allowing both administrators to execute the necessary tasks without the hassle of managing multiple duplicate tasks.