Resize and move open windows

I have a script to open 8 windows using VNC viewer (for seeing screens from computer). This works fine. After the script runs and I have the 8 windows open, I have to manually snap them to the monitors so they look tiled. Is there a way to resize a window and move it using powershell?

This is what I have so far. This just opens the 8 screens using TightVNC Viewer.

$laptops = '172.16.2.88', '172.16.1.145', '172.16.2.75', '172.16.2.87',
'172.16.2.84', '172.16.2.83', '172.16.2.79' , '172.16.2.77'

$wshell = New-Object -ComObject wscript.shell;

foreach ($l in $laptops) {
Start-Process -FilePath 'C:\Program Files\TightVNC\tvnviewer.exe'
sleep 2
$vlc = Get-Process -Name tvnviewer
sleep 1
$wshell.SendKeys($l)
Write-Host "Using VNC for" $l -ForegroundColor Green
sleep 1
$wshell.SendKeys('~')
sleep 1
$wshell.SendKeys('12345')
sleep 1
$wshell.SendKeys('~')
sleep 1
}

What are you asking here?

8 separate monitors and tiled does not make since. If you have 8 windows open and 8 monitors to use, are you saying, you want each window on one of each monitor?

Tiled, means you want them on one monitor, then you’d call windows proper to tile / cascade windows feature not use sendkeys stuff.

For example:

https://devblogs.microsoft.com/scripting/how-can-i-tile-the-windows-on-the-desktop/

 

 

One monitor, with 8 VLC windows open. I’m able to use AutoIT scripts to move and resize windows, so may be that’s the right path. I just need to figure out the coordinate system, but so far AutoIT is doing what I want.

Yeppers, PS is not really the first choice for GUI / App Window automation.

AutoIT, Selenium, WASP, etc. are purposed built things for such efforts. Well, there’s rolling your own via .Net natively, but that requires you to know C# and how to tap the Win32 API to do that.

I was able to use PowerShell and AutoIT to automatically snap windows. Everything works the way I want.