How could be possible to run powershell commands piped to specific PIDs on a text file on C:\\PIDs.txt?<\/p>\n
the PIDs.txt would be something like<\/p>\n
12345 123 1234 13452 …<\/p>\n
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<\/p>\n
Thanks<\/p>","upvoteCount":5,"answerCount":4,"datePublished":"2022-02-26T20:51:08.000Z","author":{"@type":"Person","name":"spiceuser-ez549","url":"https://community.spiceworks.com/u/spiceuser-ez549"},"suggestedAnswer":[{"@type":"Answer","text":"
How could be possible to run powershell commands piped to specific PIDs on a text file on C:\\PIDs.txt?<\/p>\n
the PIDs.txt would be something like<\/p>\n
12345 123 1234 13452 …<\/p>\n
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<\/p>\n
Thanks<\/p>","upvoteCount":5,"datePublished":"2022-02-26T20:51:08.000Z","url":"https://community.spiceworks.com/t/powershell-commands-on-multiple-windows/826211/1","author":{"@type":"Person","name":"spiceuser-ez549","url":"https://community.spiceworks.com/u/spiceuser-ez549"}},{"@type":"Answer","text":"
What are you trying to do this for? Hearing the blanket statement I think you need a more streamlined plan<\/p>","upvoteCount":1,"datePublished":"2022-02-26T22:00:21.000Z","url":"https://community.spiceworks.com/t/powershell-commands-on-multiple-windows/826211/2","author":{"@type":"Person","name":"robosborne88","url":"https://community.spiceworks.com/u/robosborne88"}},{"@type":"Answer","text":"
Powershell remote services need to be enabled on the systems that you want to interact with to run commands. By default, windows does not have this enabled, but you could enable it via group policy.<\/p>\n
Regards,<\/p>\n
Jeff Cummings<\/p>\n
MIS Technician<\/p>\n
Hobby Video Game Programmer<\/p>","upvoteCount":0,"datePublished":"2022-02-26T22:01:08.000Z","url":"https://community.spiceworks.com/t/powershell-commands-on-multiple-windows/826211/3","author":{"@type":"Person","name":"jeffreycummings","url":"https://community.spiceworks.com/u/jeffreycummings"}},{"@type":"Answer","text":"
you probably want to run ‘get-process’ to get the PIDs?<\/p>\n
Can you elaborate a bit more?<\/p>\n
Do you just want the eventlogs? The PowerShell logs? something else?<\/p>\n
What part exactly are you stuck with?<\/p>\n
If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n