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

Executing Powershell script with parameters remotely

$
0
0

I am trying to have one of our APP servers to serve as a central PS script server.  Basically to have all the scripts we use run from a central point.

I can run PS remotely etc but I'm having trouble passing parameters to a script the is running remotely.

For example to run this script locally:

Powershell.exe -file '.\Cleanup.ps1' -Path "D:\Shares\NZArchive" -Days 30 -Exclude "D:\Shares\NZArchive\CST"

When running remotely though, say using 'Invoke-Command' how do I pass those same parameters to the script?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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