There are two sets of credentials you might need when renaming a scheduled task using Rename-ScheduledTask.ps1:
- The -ConnectionCredential parameter specifies the credentials to use to connect to the schedule service on the computer where the task is stored (either the local computer or a remote computer). If you aren't a member of the Administrators group on the computer hosting the task, you can connect to the schedule service using administrator credentials.
- The -TaskCredential parameter specifies the credentials for the task itself, if needed. Task credentials are needed only when the task's Run whether user is logged on or not option is selected and the Do not store password option is not selected. If credentials are required and you don't specify the
-TaskCredential parameter, the script will prompt you for credentials.
Both the -ConnectionCredential and -TaskCredential parameters require a PSCredential object as their argument. A PSCredential object securely stores a username and password for use in security operations. However, there is an important caveat you need to know about: Rename-ScheduledTask.ps1 converts the secure passwords in PSCredential objects to plain text because the scripting object model doesn't support PSCredential objects.
You can easily create PSCredential objects by using the Get-Credential cmdlet. Run the command
at a PowerShell prompt for more information about PSCredential objects.