Click to Rate and Give Feedback
MSDN
MSDN Library
Task Scheduler
ITaskScheduler
 ITaskScheduler::SetTargetComputer M...

  Switch on low bandwidth view
ITaskScheduler::SetTargetComputer Method

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

pwszComputer [in]

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.

Note  When specifying a remote computer name, use two back-slash characters before the computer name. For example, use "\\ComputerName" instead of "ComputerName".

Return Value

The SetTargetComputer method returns one of the following values.

Return codeDescription

S_OK

The method was successful.

SCHED_E_SERVICE_NOT_INSTALLED

The Task Scheduler service is not installed on the target computer.

E_ACCESS_DENIED

The user does not have access to the remote computer.

E_INVALIDARG

The pwszComputer parameter is not valid.

E_OUTOFMEMORY

A memory allocation failure occurred.

Remarks

For a Windows Server 2003, Windows XP, or Windows 2000 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.

Aa381831.wedge(en-us,VS.85).gifEnable the "Share File and Printers" exception in Windows Firewall

  1. Click Start, and then click Control Panel.
  2. In Control Panel, click Classic View and then double-click the Windows Firewall icon.
  3. In the Windows Firewall window, click the Exceptions tab and select File and Printer Sharing exception check box.

Aa381831.wedge(en-us,VS.85).gifEnable the "Remote Registry" service

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
RedistributableInternet Explorer 4.0 or later on Windows NT 4.0 and Windows 95
HeaderMstask.h
LibraryMstask.lib
DLLMstask.dll

See Also

ITaskScheduler


Send comments about this topic to Microsoft

Build date: 10/29/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker