Param (
    [string]
    $PasswordstateList,

    [string]
    $PasswordstateTitle,

    [string]
    $Description,

    [string]
    $UserName
)

$Credential = $Secret:svcitdiaasauto

$NewITDPasswordParams = @{
PasswordList = $PasswordstateList;
Title        = $PasswordstateTitle;
Description  = $Description;
UserName     = ("ndgov\$SamAccountName");
Credential   = $Credential;
}

switch ($PSBoundParameters.Keys) {
PasswordStateNotes {
    $NewITDPasswordParams.Notes = $PasswordstateNotes
}
}

$NewITDPasswordResult = New-ITDPassword @NewITDPasswordParams -ErrorAction Stop