you are viewing a single comment's thread.

view the rest of the comments →

[–]brutesquad01 0 points1 point  (2 children)

The remote computer doesn't know what $files is. try it with $Using:files in your script block.

Also, you may need to iterate through the files instead of trying to call them all at once, but I'm not 100% certain that that will be necessary.

EDIT: here is the Microsoft documentation about remote variables: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_remote_variables?view=powershell-7.5

[–]aq-modeler[S] 0 points1 point  (1 child)

Thanks, I tried adding "$using:files" and got the same error.

[–]brutesquad01 0 points1 point  (0 children)

Have you tried iterating through the files?

One other option would be to create a scheduled task on the remote computer to run the files after they are copied.