I have used @Ibaibm approach and my powershell script as below:
“$bstr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($in_Password)
$PlainTextPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($bstr)
net use $in_DriveLetter $in_SharedNetworkPath /user:$in_Username $PlainTextPassword”
where in_Username, in_Password, in_DriveLetter, in_SharedNetworkPath are the Powershell variable. Please refer attached screenshot