First try to get the script to work locally, then replicate it on your remote command
This could be an example of the local command:
$PIDS = Get-Content C:\PIDs.txt
ForEach ($PID in $PIDS) {
Write-Output $PID
}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How could be possible to run powershell commands piped to specific PIDs on a text file on C:\PIDs.txt?
the PIDs.txt would be something like
12345
123
1234
13452
...
This is a very simple example but would be run "Invoke-Command -ScriptBlock {Get-EventLog system -Newest 50}" and "Get-Content "C:\Services.txt" on all the open powershell windows
Thanks
First try to get the script to work locally, then replicate it on your remote command
This could be an example of the local command:
$PIDS = Get-Content C:\PIDs.txt
ForEach ($PID in $PIDS) {
Write-Output $PID
}