ICluster::SetJobCredentialsFromCache method

Sets the credentials for the specified job using credentials from the credential cache.


HRESULT SetJobCredentialsFromCache(
  [inlong         jobId,
  [in] BSTR         userName,
  [in] VARIANT_BOOL isConsole,
  [inlong         hwndParent


jobId [in]

The job identifier. The ICluster::AddJob method returns this value. If you have an instance of the job that has already been added to the cluster, you can call the IJob::get_Id method to get the identifier.

userName [in]

The name of the RunAs user, in the form domain\user. The user name is limited to 80 Unicode characters.

If userName is NULL, empty, or not valid, the service searches the credential cache for the credentials to use. If the cache contains only one credential, that credential is used. However, if multiple credentials exist in the cache, the user is prompted for the credentials.

isConsole [in]

Set the value to VARIANT_TRUE if the application is a console-mode application. Set the value to VARIANT_FALSE if the application is a GUI application.

If the credentials are not cached, the user is prompted for the credentials. If the isConsole parameter is VARIANT_TRUE, the user is prompted in the console window; otherwise, the standard credentials dialog box is used.

hwndParent [in]

The handle to use as the parent window for the modal credentials dialog box. If 0, HWND_DESKTOP is used. The handle is ignored if isConsole is VARIANT_TRUE.

Return value

If the method succeeds, the return value is S_OK. Otherwise, the return value is an error code. To get a description of the error, call the ICluster::get_ErrorMessage method.


You would call this method after submitting a job to change the credentials that the job uses.

To add credentials to the cache, use the ICluster::SetCachedCredentials method.



Compute Cluster Pack Client Utilities

Type library


See also