How to run the below command in PowerShell. The below command will prompt for a password and user needs to enter it. I want to automate it.
mxexport [ -f <zip file name> ]
I tried saving password in a file and run the below script in PowerShell:
$password = get-content C:\cred.txt | convertto-securestring
$pass=[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))
& 'C:\Program Files\XX\XX\bin\mxexport.exe' -f file.zip, -p $pass
But I am getting the below Error:
mxexport.exe'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Error while getting password from User.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
$passwordand$pass? Are you sure are callingmxexportwith the correct value? Have you tried callingmxexportwith a hard-coded value for$pass?