PSU variable PSCredential

Product: PowerShell Universal
Version: 5.0.10

I would like to know how to use the set-PSUvariable to add PScredentials username and password from a script?
The -value attribute only seems to accept a string. But if you enter a string value I get the following error
“Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.”
I tried parameters like Username and Password. But they are not accepted.
If the type is not PScredential it all seems to work. But of course I need the type PScredential.
Can someone help me?

Ok,
Found this to be working.
First create a PSCredential object.
Then Use Get PSVariable to get the variable object you want to update.
Then use the following.
Set-PSUVariable -TrustCertificate -variable $varobject -inputobject $credObject.

This works for me.