Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

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

$
0
0

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


Viewing all articles
Browse latest Browse all 21975

Trending Articles