Forum Discussion

sjn001tvh's avatar
sjn001tvh
Copper Contributor
Jan 22, 2025

positioning a set of powershell windows

Greetings,

I'm completely new to this area.  I have a requirement to display 3 separate powershell windows that are created from nodejs on my server, in essentially this format,

-------  ----------------------------

|     1   | |              2                        |

------- -----------------------------

-------------------------------------

|                       3                             |

--------------------------------------

 

  1. is the monitoring server app
  2. is the adminController app
  3. is the mainServerHub for all client connections to main app.

 

  1. is started manually on the server and automatically positions itself on the screen
  2. is created by the monitoring server app (1) and should be positioned on the right of screen 1
  3. is also created by the monitoring server app (1) and should be positioned under both 1 and 2

I have searched many descriptions and links to resolve this challenge.  I'm successful in creating all of the powershell windows from nodejs, but it has quite a challenge trying to manipulate their positions, and I'm looking for the appropriate cmdlets to accomplish this task.

Can anyone point me in the right direction?

Thanks

Scott.

 

  • luchete's avatar
    luchete
    Steel Contributor

    Hello, 

    I haven’t had the exact same situation, but I can try to offer some guidance. To position the PowerShell windows, you can use PowerShell's Add-Type cmdlet to access Windows Forms or WPF for managing window positions. After launching the PowerShell windows from Node.js, you can use the System.Windows.Forms library to control window sizes and positions. You’d likely need to grab the window handles and adjust their locations with methods like SetWindowPos. If that doesn’t fully solve it, automation tools like AutoHotKey can sometimes help with moving and resizing windows more dynamically.

    Hope it helps!

Resources