DMT Powershell Flags/Switches

Hi Joe,

I don’t have a full list but this is what I used. I put my variables in a file:

$basePath = Get-Location
$logPath = “$basePath” + “\log”
$DataPath = “$basePath” + “\Data”
$logFile = “$logPath” + “\LoadLog_” + $(Get-Date -Uformat “%Y%m%d%H%M%S”) + “.txt”
$DMTPath = “E:\Epicor\ERP10.0Client\Client\DMT.exe”
$User = “MANAGER”
$EpicorConfig = “ERP10”

(The EpicorConfig variables uses the same environment name you would see in your DMT drop down when logging in via the GUI)

Then I import these variables into my scripts:

Load Session Variables

…\Scripts\SessionVars.ps1

And then execute DMT like this

Start-Process -Wait -FilePath $DMTPath -ArgumentList "-User $User -Pass $Password -ConfigValue=$EpicorConfig -NoUI -Add=true -Update=true -Import "Asset Group" -Source $Source "

Note you need the spaces in the Import statement (in this case “Asset Group” and you use the back-tick to escape the quotes.

Finally, if you don’t want to code your password in your scripts but want to prompt for it:

Prompt for password for session

$Password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword))

Hope that helps,

Mark W.

3 Likes