Run PS1 on remote server

Yes i did a search. Mostly ones that comes up are not what i’m looking but could be the word i use to search.

current situation:
logon server01 and open powershell
run c:\Scripts\Collection.ps1 option1 option2 option3

I want to bypass remote logon,
i can access \server01\Scripts without any credential

can i run ps1 script from \server01\Scripts\collection.ps1 options1 option2 option3?
example Invoke-Command -ComputerName Server01 -FilePath c:\Scripts\Collection.ps1 option1 option2 option3

or would be better if i can run from window batch file because i have scripted for IF and SET for options1, 2, 3

you probably wondered, have i test it yet, no not yet. i want to make sure it is even close to working. Dont want to cause to much traffic issue if command does’t work.

any help and recommendation would be great.

Welcome to the forums.

You’re perfectly right. :wink:

How much time would it have taken you to write a mini test script and try it? And how long did it take you to come here, create an account and write this question? :wink:

And how much traffic can it cause with a few lines of code to test? :wink:

It took me about 30 seconds to Google for “Powershell run script remote including arguments” and the first hit was this:

1 Like

As I mentioned. It’s probably the wording. I just searched run powershell from remote server.
You had “argument” could be the crucial word.

One failed test script will send fault info to 2nd party intended. They would not like it if I keep recalling.

Nice, decided to joined to get help after many searches. My help was redirected to another site.

You are right. Very much wasted of time registering and asking and even get insulted.

Thank you I will seek help there.