Start Microsoft Edge maximized on first run

1

I'm developing an image for Windows 10 to deploy, and one of the requirements is that when Edge is started for the first time it should be maximized (not fullscreen, but maximized - the same result as clicking the maximize button in the title bar).

I've tried using the powershell start-process commandlet with the -WindowStyle Maximized argument, but this is not honoured, e.g.:

start -windowstyle Maximized microsoft-edge:http://www.example.com

I've tried various powershell solutions which resize other program windows (with the idea of spawning Edge then resizing it), but they don't seem to have any effect on Edge, e.g.:

I've used Process Monitor to record what's happening when I maximize then shutdown Edge, and I can see it sets the registry keys:

  • HKCU\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main\LastClosedWidth
  • HKCU\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main\LastClosedHeight

with the horizontal and vertical size of the desktop, but manually changing these with regedit doesn't change the size of Edge when I start it again.

If Edge is made fullscreen then exited, it starts fullscreen in the future - is there a way to start Edge maximized without this manual intervention?

Jonathan Barber

Posted 2016-06-18T03:53:18.953

Reputation: 113

Answers

2

Just sending the keystrokes for alt+space, then X maximizes window. See below powershell script. Save as a .ps1.

start microsoft-edge:http://google.com 
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('Google - Microsoft Edge')
Sleep 2
$wshell.SendKeys('(%(" "))')
Sleep 2
$wshell.SendKeys('(x)')

Narzard

Posted 2016-06-18T03:53:18.953

Reputation: 2 276

Although setting the registry keys proposed by @w32sh works, it looks like I'd have to change the values for every display size - which might not be a problem but the registry key values are opaque blobs. So this solution looks more robust. n.b. that TFM states AppActivate can take a PID instead of a window title.

– Jonathan Barber – 2016-06-22T09:17:36.113

1

LastClosedWidth and LastClosedHeight may not be required if you're maximizing the window. The following binary values store the settings for maximized window. You may deploy the registry setting to PCs that use the same screen resolution.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationFrame\WindowSizing\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge]
"PreferredLaunchViewSize"=hex:80,07,00,00,f0,03,00,00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationFrame\Positions\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge]
"PositionObject"=hex:2c,00,00,00,02,00,00,00,03,00,00,00,ff,ff,ff,ff,ff,ff,ff,\
  ff,ff,ff,ff,ff,ff,ff,ff,ff,80,02,00,00,00,00,00,00,40,07,00,00,ac,03,00,00

Those binary values are from my system with current display resolution set to 1920x1080. The REG export was provided as an example.

w32sh

Posted 2016-06-18T03:53:18.953

Reputation: 8 611

To get this to work on a 1024x768 display I had to use different values and add the key PreferredLaunchWindowingMode (adjacent to PreferredLaunchViewSize) with a value of 1. – Jonathan Barber – 2016-06-22T09:13:48.873