ITaskScheduler::SetTargetComputer method (mstask.h)
[[This API may be altered or unavailable in subsequent versions of the operating system or product. Please use the Task Scheduler 2.0 Interfaces instead.] ]
The SetTargetComputer method selects the computer that the ITaskScheduler interface operates on, allowing remote task management and enumeration.
Syntax
HRESULT SetTargetComputer(
[in] LPCWSTR pwszComputer
);
Parameters
[in] pwszComputer
A pointer to a null-terminated wide character string that specifies the target computer name for the current instance of the ITaskScheduler interface. Specify the target computer name in the Universal Naming Convention (UNC) format. To indicate the local computer, set this value to NULL or to the local computer's UNC name.
Return value
The SetTargetComputer method returns one of the following values.
Return code | Description |
---|---|
|
The method was successful. |
|
The Task Scheduler service is not installed on the target computer. |
|
The user does not have access to the remote computer. |
|
The pwszComputer parameter is not valid. |
|
A memory allocation failure occurred. |
Remarks
For a Windows Server 2003, Windows XP computer to create, monitor, or control tasks on a Windows Vista computer, the following operations should be completed on the Windows Vista computer, and the user who is calling the ITaskScheduler::SetTargetComputer method must be a member of the Administrators group on the remote Windows Vista computer.
Enable the "Share File and Printers" exception in Windows Firewall
- Click Start, and then click Control Panel.
- In Control Panel, click Classic View and then double-click the Windows Firewall icon.
- In the Windows Firewall window, click the Exceptions tab and select File and Printer Sharing exception check box.
Enable the "Remote Registry" service
- Open a Command Prompt window and enter the following command: net start "Remote Registry"
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | mstask.h |
Library | Mstask.lib |
DLL | Mstask.dll |