tse.dba
(Andrew Koemm)
January 26, 2018, 9:02pm
1
So I am trying to create a powershell script to import data into the Product Group table. I use the following script:
Start-Process -Wait -FilePath $DMTPath -ArgumentList "-User $User -Pass $Pass -Delete -Import “Product Group” -Source $Source "
I get this message:
So my Import variable is not accepting spaces. How do I get it to except spaces.
It works fine with “Part”, because no spaces.
Thanks!
1 Like
duckor
(Dan)
January 26, 2018, 9:33pm
2
Have you tried single quotes?
markdamen
(Mark Damen)
January 27, 2018, 12:28am
3
I ended up doing it like this:
$ImportName = ‘“Part Warehouse”’
Start-Process -Wait -FilePath $DMTPath -ArgumentList “-SSO -Add -Import $ImportName -Source $Source1”
Rick_Bird
(Rick Bird)
January 28, 2018, 12:27am
4
Been there done that… it’s a pain.
You need to use the PowerShell escape character, the ‘backtick’ AKA, ‘grave accent.’ This is usually the key to the left of the 1 key.
-Import `"Product Group`"
At Insights last year I did a session on DMT PowerShell and I covered this struggle, examples and such are on my blog:
9 Likes
tse.dba
(Andrew Koemm)
January 29, 2018, 1:38pm
5
Thanks! That worked. I did find something about backticks. I didnt know how to lay them out.
tse.dba
(Andrew Koemm)
January 29, 2018, 5:36pm
6
Is there a way to run it without the DMT interface popping up?
Rick_Bird
(Rick Bird)
January 29, 2018, 5:44pm
7
Yes just include the -NoUI argument:
Start-Process -Wait -FilePath $DMTPath -ArgumentList "-User $User -Pass $Pass -Update -Import `"Sales Order Header`" -NoUI -Source $Source "
I did not include the -NoUI in some of my examples since the Task Scheduler was calling the PowerShell script and so it’s not really needed.
-Rick Bird
www.getaligned.solutions
1 Like
tse.dba
(Andrew Koemm)
January 29, 2018, 5:52pm
8
Where can i find a list of arguments?
DMT /? will give them to you if run at the command line.
Mark W.
1 Like
Banderson
(Brandon Anderson)
October 5, 2018, 6:47pm
11
So I am trying to get a powershell script to run a simple DMT load (trying to learn something today). I am not having any success, and I can’t really tell what I am doing wrong. Can someone take a quick look at tell my why this wouldn’t work? We run this is DMT all of the time.
$DMTPath = "C:\Epicor\ERP10.2Client\Client\DMT.exe"
$User = "user"
$Pass = "password"
$source = "C:\Users\banderson\Desktop\A1 MasterComment.csv"
Start-Procss -Wait -FilePath $DMTPath -ArgumentList "-User $User -Pass $Pass -Update -Import `"Bill Of Operations`" -Source $Source "
Banderson
(Brandon Anderson)
October 5, 2018, 6:55pm
12
never mind. Typo, “Process”
Try
Start-Process -Wait -FilePath $DMTPath -ArgumentList "-User $User -Pass $Pass -Update -Import `Bill Of Operations` -Source $Source "
I don’t think you want the double quotes are the Bill of Material, going from memory here.
Banderson
(Brandon Anderson)
October 5, 2018, 6:57pm
14
it worked when I fixed the typo.
1 Like
Banderson
(Brandon Anderson)
October 5, 2018, 6:59pm
15
Mark_Wonsil:
going from memory here.
You didn’t need to go from memory, you just had to scroll up! Thanks @Rick_Bird for the examples.
1 Like
Banderson
(Brandon Anderson)
October 5, 2018, 7:06pm
16
ok new problem. I had a inkling that it was spaces in the file location that was giving my a problems, so I copied a sample file and removed spaces. It still didn’t work, so I kept going and found the typo.
Now when I put it back to the actual file name, it bombs out at the space. Is there a way to handle spaces in file name/locations in powershell?
ckrusen
(Calvin Krusen)
October 5, 2018, 7:49pm
17
Is it not possible to force the input files to use underscores (or no spaces at all)?
Banderson
(Brandon Anderson)
October 5, 2018, 7:50pm
18
It’s possible. It’s just already set up, so changing it is extra work that I don’t want to do if I don’t have to.
1 Like
ckrusen
(Calvin Krusen)
October 5, 2018, 7:56pm
19
I figured as much. If it was me, I’d spend the time figuring out how to pass arguments with quotes in them. Just because I’d refuse to be beat!
How about:
$argList = "User $User -Pass $Pass -Update -Import `"Bill Of Operations`" -Source `"$Source`" "
In case it’s not obvious, I added the grave and quote, before and after the var $Source, keeping the close quote
EDIT: THIS DON’T WORK!!!
Banderson
(Brandon Anderson)
October 5, 2018, 7:59pm
20
That doesn’t work at all…