Task Scheduler is unable to fetch credentials from Windows Credential Manager. It’s returning null for the username and password

Ava Tomlinson 96 Reputation points
2024-05-23T12:09:22.66+00:00

We have one Task Scheduler job using Credential Manager to store service account credentials(Generic). After a password change, we started facing this issue. We have a PowerShell script configured as a Task Scheduler job that uses Credential Manager to validate and manage credentials. The script works fine from the PowerShell console but returns null for the username and password when run from Task Scheduler.

Get-StoredCredential -Target "XYZ" : returning Null Value

We have tried the following option: set a new credential in the script, ran it one time, and then removed it.

New-StoredCredential -Target "" -UserName "" -Password "" -Persist LOCAL

Custom Logs-

08:00:11.8435 Information Init-Logger Starting process...

08:00:12.0623 Information Get-Assembly Credentials Manager loaded

08:00:12.1873 Error Get-SPOContextByCredMngr Exception calling ".ctor" with "2" argument(s): "The 'username' argument cannot be null.

Parameter name: username"

Could you please suggest any solution to this problem?

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,635 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,462 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,328 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 34,271 Reputation points Microsoft Vendor
    2024-05-24T01:12:19.4233333+00:00

    Hi Ava Tomlinson,

    Thank you for posting in Q&A.

    The issue seems to be more related to the CredentialManager module. Since it's a third-party module, it is recommended to contact the author of the module or ask the question at the Issues page of the repository on GitHub.

    https://github.com/davotronic5000/PowerShell_Credential_Manager/issues

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments