Public/Get-PASAdminCredential.ps1

Function Get-PASAdminCredential {
    <#
.SYNOPSIS
    This Function uses the psPAS Module to get admin credentials for the WFM Network
 
.NOTES
    Name: Get-PASAdminCredential
    Author: Luke Hagar
    Version: 1.0
    DateCreated: 5/13/2021
 
.EXAMPLE
    $AdminCredential = Get-PASAdminCredential
 
#>

    [CmdletBinding()]
    param (
        [Parameter()]
        $PASAccount
    )
    if (!($PASAccount)) {
        $PASAccount = Get-PASAccountList
    }
    $Username = $PASAccount.platformAccountProperties.LogonDomain + "\" + $PASAccount.userName 
    $Password = (Get-PASAccount -ID $PASAccount.id | Get-PASAccountPassword).ToSecureString()
    $AdminCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username, $Password
    Write-Verbose $AdminCredential
    Return $AdminCredential | Sort-Object -Unique
}