r/PowerShell • u/Worried-Tax-9782 • Mar 27 '26
User Login PS-Script to start specific programs on specific area on 3-display-setup
Hi everyone,
on my laptop in home office, I want to have a startup script for starting all my programs and position them always on the same exact spot on one of my screens.
Here is the script so far, what works for just opening the programs on a non-specific area on screen:
Write-Host "Start VMware Workstation"
& 'C:\Program Files (x86)\VMware\VMware Workstation\vmware.exe'
Write-Host "Start Notepad"
& 'C:\Program Files\Notepad++\notepad++.exe'
Start-Process -File "$($env:USERProfile)\AppData\Local\Microsoft\WindowsApps\ms-teams.exe"
# ... further programs... #
Thanks for your ideas and implementations
5
u/raip Mar 27 '26
You'll probably have to drop down to Win32 API + P/Invoke to do this in Powershell. Launching applications is easy, setting Window positions and sizes is more difficult. Check out https://www.powershellgallery.com/packages/SciProfile/0.3.0/Content/PSModuleUtilsFunctionsSet-Window.ps1
You'd probably be better off with AutoHotkey, Power Automate, or even FancyZones as a solution for this.
4
u/PeeCee1 Mar 27 '26
I‘d use Powertoys Workspaces to define the Location and the Apps. Then use created shortcut in the login script.
3
u/DrunkenBlacksmith Mar 27 '26
Not a PowerShell answer but it works well is PowerToys Workspace.
PowerToys Workspaces is a desktop manager utility that helps you launch applications to custom positions and configurations with a single click.
https://learn.microsoft.com/en-us/windows/powertoys/workspaces
2
u/DonL314 Mar 27 '26
I made a PS based tool for repositioning windows. I'll be happy to share. Let me get home first
1
u/tstager Mar 27 '26
This can be done but it will require p/invoke and the win32 api. I believe the function you will need is in the user32.dll. There is a p/invoke website that will help you cast and implement the c++ com signature in c#. Then you can add the type and call the function. I've probably even go an implementation that I used to switch main monitors back and forth from the terminal.
1
u/PlannedObsolescence_ Mar 27 '26
Are you certain you need to use PowerShell for this?
Microsoft PowerToys has a feature called FancyZones to do window arrangements. It can place windows back into whatever position they were when re-opened.
1
u/radehart Mar 27 '26
For an OS named ‘windows’ it sure is the absolute worst manager of windows.