Data Loader has no built-in credential storage facility, and the -l and -p sign in parameters must be supplied as clear text when running the command.

We recommend avoiding storing user names and passwords in clear text within scripts, and instead use a credential storage method such as the one described below.

Store the credentials in the Windows Credential Manager:

Install-Module CredentialManager -Scope CurrentUser -Force
 
$token = Read-Host "Enter token"
$secret = Read-Host "Enter secret"
 
New-StoredCredential -Target 'IRMDataLoader' -UserName $token -Password $secret -Type Generic -Persist LocalMachine
Write-Host "Credentials stored."

NOTE: The command below is an example only. Replace sample.xml and rmcluster with your own data file and cluster name before running the command.

To retrieve the credentials while running the Data Loader:

$cred = Get-StoredCredential -Target 'IRMDataLoader'
if ($null -eq $cred) {
Write-Error "No credentials found."
exit 1
}
 
.\IRMDataLoader -f <sample.xml> -l $cred.UserName -p $cred.GetNetworkCredential().Password -c <rmcluster>
exit $LASTEXITCODE