Powershell with -ArgumentList

375 Views Asked by At

I want to run following command in Powershell: AFImport.exe

[https://docs.osisoft.com/bundle/pi-server/page/afimport-utility.html][1]

Syntax Example #1

AFImport "\\AFServer\database" /File:"C:\Filename.xml" /P

Now I made following code:

Set-Location -Path "$Env:pihome64\AF"
$xml = "C:\Temp\test.xml"
$AF = "\\AFtest\AF-test"
$log = "C:\Temp\log.txt"
Start-Process AFImport.exe -ArgumentList '$AF','File:$xml','/P' -Wait -RedirectStandardOutput $log

When executting the script the CMD window an runs AFImport.exe but nothing is shown and closes after a few seconds.

What syntac error do I have?

0

There are 0 best solutions below