0

Using a powershell script with robocopy launch by gMSA is not working ...

I write a little script to copy 2 directories in powershell with robocopy and it works. I use it with the task sheduler, with a normal account, it works. But doing the same with a gMSA, does'nt work

$logfile = "C:\Scripts\SyncFTP\Logs\SRV-IIS-1.txt"
$options = @("/E","/ZB","/X","/COPYALL","/XO","/FFT",("/LOG:" + $logfile))
$args = @("$pathFTP2","$pathFTP1",$options)
robocopy @args

Here is the log file of Robocopy when it is launch with gMSA :

ERROR : Invalid Parameter #10 : "C:\Scripts\SyncFTP\Logs\SRV-IIS-1.txt"

It is like the $logfile was not correct only when it is launched by gMSA...

Have you got some ideas ?

Yann F.
  • 91
  • 3
  • 14
  • https://stackoverflow.com/questions/6338015/how-do-you-execute-an-arbitrary-native-command-from-a-string – Yann F. May 22 '19 at 13:05

1 Answers1

0

In my case, i do it like this :

Invoke-Expression "& robocopy $pathFTP2 $pathFTP1 /E /X /COPY:DATSO /XO /FFT /LOG:$logfile"

It seems to work now , before the WE ^^

Yann F.
  • 91
  • 3
  • 14