While exploring I have noticed some people used the command Get-StoredCredential.
I have got a need to store my credentials in Windows Credentials manager and get the stored username and password to use in a Powershell script which is used in unattended scheduled task.