...
The following example shows how to add and read credentials by use of the cmdkey
command:
...
- The
Get-JobSchedulerSystemCredentials
cmdlet accepts the target name of a system credentials object that is owned by the current user. This cmdlet returns a system credentials object. - The
Set-JobSchedulerCredentials
cmdlet expects a PowerShell credentials object, that is used for authentication when accessing the JobScheduler Master. - Therefore a A conversion of system and PowerShell objects is required that can be achieved e.g. like this:
...
- Line 1 imports the JobScheduler PowerShell Module
- Line 2 reads an existing system credentials object that has been stored with the target name
login_as_ap
. - Line 3 copies the user account and password of the system credentials object to the PowerShell credentials object. The password is provided as a secure string, i.e. it is not visible and cannot be logged.
- Line 4 forwards the PowerShell credentials object to the JobScheduler CLI for authentification with the JobScheduler Master.
...
- A credentials object is forwarded to the JobScheduler Master should authentication be required.
- This operation can be carried out at any time and is valid for starting from the next request that is sent to the JobScheduler Master.
...
Using the PowerShell profile to apply credentials
- Credentials can be added to the JobScheduler CLI by a PowerShell profile.
- A number of locations are available for profiles.
- Check the value of the
$Profile
built-in variable for the currently active profile.
- You can copy & paste the above example for use of the
Get-JobSchedulerSystemCredentials
cmdlet to your PowerShell profile. This allows to automatically use the specified credentials for the JobScheduler Master.