I Have power shell script which runs fine when it is located on local computer. if i run test.ps1 file, it executes. Test.ps1 has a code to use current working directory and reads xml file from current working directory
When i'm trying to use invoke-command and run this script from file share i'm receiving error message unable to find path or so .. here is my syntax:
Invoke-command -computername "test1" -filepath "\\xyz\test\test.ps1"
above syntax didn't work...
then i tried couple of things like
invoke-command -computername "test1" -scriptblock{\\xyz\test\test.ps1}
and
invoke-command -computername "test1" -scriptblock{(param $x) \\xyz\test\test.ps1} -Argumentlist $scriptroot
None of them worked..