Grab Safe Guard password from Powershell Script

Hi Team. 

I am just getting around to looking at getting username and passwords out of PowerShell scripts. 

What i am looking to do via Powershell is grab the credential out of Safe Guard and it use it within the script. From the brief reading i have done i think i need to use an account that has certificate based authentication. 

Out side of that does anyone have any real world examples on doing this? any same scripts to interface with SG to obtain a password?

Thanks in advance 

Craig