Powershell DMT Import and Add New

Is it possible ot havc a powershell script that adds new rows via DMT to a UD table>? If so, waht is that script? I ahve tried

Start-Process -Wait $DMTPath -ArgumentList “-User=Manager -Pass=$DMTPass -Noui -import "UD10" -AddNew -Source C:\Folder\File.csv -configvalue=Epfake.sysconfig”


Start-Process -Wait $DMTPath -ArgumentList “-User=Manager -Pass=$DMTPass -Noui -import "UD10" -Update -Source C:\Folder\File.csv -configvalue=Epfake.sysconfig”

The first one, doesn’t do anything, the second one errors out saying that it couldn’t find the data in the table.

UPDATE: This worked:

Start-Process -Wait $DMTPath -ArgumentList “-User=Manager -Pass=$DMTPass -Add -Update -import "UD10" -Update -Source C:\Folder\File.csv -Noui -configvalue=Epfake.sysconfig”

Hi Will,

IDK if there’s anything special about the UD add new. I’d run it manually via DMT to ensure data going in good, then take it for automation via Powershell.

I have serial number attachment records getting uploaded. I got it going via following this thread from Rick Bird (thanks Rick!), and the code below:
#Load Data via DMT
Start-Process -Wait -FilePath $DMTPath -ArgumentList “-User $User -Pass $Pass -Add -Update -Import "Serial Number Attachment” -Source $SourcePath -NoUI -ConfigValue=ERP10"


1 Like

On the lines of what @Nancy_Hoyt was saying, the use of variables(that contain strings) in a power shell script can get dicey.

I think the $DMTPass in the -Arguments parameter won’t be expanded.

You might want to try making a string variable to hold the all the arguments, and pass that to the Start-Process command.


Or make it a list of arguments, by separating them with commas(like):

Start-Process -Wait $DMTPath -ArgumentList "-User=Manager", "-Pass="+$DMTPass, "-Noui", "-import", "`"UD10`"", "-AddNew",  "-Source C:\Folder\File.csv", "-configvalue=Epfake.sysconfig"

2nd Edit

The MS page says

For the best results, use a single ArgumentList value containing all of the arguments and any needed quote characters.

So maybe the above isn’t the best. but trying to make a string that contains other strings that contain quotation marks can get tricky.

1 Like

Here’s a good bit on quoted strings in powershell:


That’s awesome Calvin. Thank you! I really prefer to know why instead of just how :rofl:


1 Like