I want to pass parameter in another ps1 file, but I have problem to send parameter
my code:
#loginWindow.ps1
$userName=$var_txt_username.Text
[SecureString] $password=ConvertTo-SecureString $var_txt_password.Password -AsPlainText -Force
$myPath="$path\MainWindow.ps1"
$window.Close()
Invoke-Expression "$myPath $userName $password"
#MainWindow.ps1
param(
[string]$userName ,
[secureString]$password
)
and my error :
Cannot process argument transformation on parameter 'password'. Cannot convert the "System.Security.SecureString" value of type"System.String" to type "System.Security.SecureString".
Thank you for your help