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

Ava Tomlinson 111 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.
13,210 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,549 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,581 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Ian Xue 37,541 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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.