locked
Code not giving the desired output when running from remote server and providing the correct value when executed on local system RRS feed

  • Question

  • I am trying to execute a set of code using "Invoke-Command with computer name and path". It is executing the file but not getting the correct result. When I am executing the same code locally on the server just by using "Run with Powershell" it is giving correct output. Can anyone please help me with this.

    Example 1) Invoke-Command -ComputerName $ServerName -FilePath "\\$ServerName\C$\textfile.ps1"

    It is giving wrong output

    Example 2) textfile.ps1 ---->Run with Powershell

    It is providing correct output

    Tuesday, September 24, 2019 2:23 PM

All replies

  • There is no way to answer your question. It is too vague.  Please read the following link carefully.


    \_(ツ)_/

    Tuesday, September 24, 2019 2:33 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee


    Just do it.

    Thursday, October 3, 2019 2:23 AM