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(
            ValueFromPipeline
        )]
        $PASAccount
    )
    if (!($PASAccount)) {
        $PASAccount = Get-PASAccountList 
    }
    $Username = $PASAccount.platformAccountProperties.LogonDomain + "\" + $PASAccount.userName 
    $Password = ($PASAccount | Get-PASAccountPassword).ToSecureString()
    $AdminCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username, $Password
    Return $AdminCredential
}