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

Invoke Command

$
0
0

I am trying to use invoke command to run a .ps1 script that is located on a server to deploy software to a client machine. Here is my code:

$s = new-pssession <computername>

invoke-command -session $s -filepath '<server\folder\folder\folder with space\test.ps1>' -ArgumentList process, service

remove-pssession $s

When I run that script, nothing happens on the remote computer and I receive no error messages on my server. If I try to add credentials I get the following error message:

Invoke-Command : Parameter set cannot be resolved using the specified named parameters.

At line:1 char:1

*invoke-command -session $s -filepath '<server\folder\folder\folder with space...>

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   + CatagoryInfo               : InvalidArgument: (:) [Invoke-Command], ParameterBindingException

   + FullyQualifiedErrorID    : AmbiguousParameterSet,Microsoft.Powershell.Commands.InvokeCommandCommands

Can anyone provide some help?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>