PSCredential is a PowerShell cmdlet used to create a credential object. It is used to securely store and retrieve usernames and passwords in scripts or commands. Via the GetNetworkCredential method it is possible to retrieve the password.
Command Reference:
Variable name: $cred
Method: GetNetworkCredential
$cred.GetNetworkCredential().Password
$pass = ConvertTo-SecureString 'password123' -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential('htb.local\mmaas', $pass)