Functions/Authentication/PSCredential/ESS/New-ESSObj.ps1
<#
.DESCRIPTION This is a factory function to create a custom object containing a credential abstraction with an Encrypted Standard String Password along with specific metadata. It is used by ESS Credential Cache type to normalize credential retrieval #> Function New-ESSObj { [CmdletBinding()] Param ( # Credential TargetName [Parameter(Mandatory=$True)] [String] $TargetName, # Description/Comment [Parameter(Mandatory=$True)] [String] $Comment, # Date Created [Parameter(Mandatory=$false)] [datetime] $LastWritten = (Get-Date -Format "MM/dd/yyyy hh:mm:ss tt"), # Credential [Parameter(Mandatory=$True)] [PSCredential] $Credential ) Process { # Create Object from Input Parameters [pscustomobject]([ordered]@{ TargetName = $TargetName Comment = $Comment LastWritten = $LastWritten Password = ($Credential.Password | ConvertFrom-SecureString) Username = $Credential.UserName }) } } |