'how to run commands on multiple powershell windows

I have several powershell windows open where I need to run the same commands in all those windows . A way that I considered to do that was

Get-Process -Name 'Powershell'

and get the ID and parse the powershell commands to those PIDs

But I don't know how can this be done or even if there is any easier way to do this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source