Necesito retornar el valor de las variables desde una función. Esta es la función, pero las variables me las devuelve vacías.
function listcert
{
Get-ChildItem "P:\" -name
Write-Host ""
[string] $path = Read-Host -Prompt "Specify the path or the certificate "
if ((Get-Item "P:\$path") -is [System.IO.DirectoryInfo])
{
Get-ChildItem "P:\$path" -name
Write-Host ""
[string] $certificate = Read-Host -Prompt "Specify the certificate "
$pass = Read-Host -Prompt "Set the password for the certificate: "
[Security.SecureString] $mypwd = ConvertTo-SecureString -String $pass -Force –AsPlainText
}
else
{
$pass = Read-Host -Prompt "Set the password for the certificate: "
[Security.SecureString] $mypwd = ConvertTo-SecureString -String $pass -Force –AsPlainText
}
Remove-PSDrive P
return ,$path
return ,$certificate
return ,$mypwd
}