Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Start compmgmt.msc maximized?

76 views
Skip to first unread message

Tyler Durden

unread,
Aug 30, 2008, 6:46:39 AM8/30/08
to
Is it possible a vbscript to start compmgmt.msc maximized?

Thanks to everyone!


Pegasus (MVP)

unread,
Aug 30, 2008, 9:37:54 AM8/30/08
to

"Tyler Durden" <ab...@antispam.org> wrote in message
news:%230N$%231oCJ...@TK2MSFTNGP03.phx.gbl...

> Is it possible a vbscript to start compmgmt.msc maximized?
>
> Thanks to everyone!
>

Each time someone asks "Is it possible" I am tempted to give a straight
answser and say "Yes, it is possible." However, since you probably wanted to
ask "How can I start this snap-in maximised", here is an answer:

Set WshShell = CreateObject("WScript.Shell")
WshShell.run "cmd.exe /c compmgmt.msc", 0, False
WScript.sleep 15000
WshShell.SendKeys("% x")

Note that the script is fragile like all scripts that involve the SendKeys
method. The delay of 15 seconds may be excessive or inadequate, depending on
the number of disks and partitions that the snap-in has to process.


Tyler Durden

unread,
Aug 30, 2008, 5:49:34 PM8/30/08
to
Thank you, Pegasus. But the SendKeys method would be inadequate since the
script, that would starts other applications too, could be run on non
english XP installations.

Do you know of any freeware, small executable to start applications in a
maximized window?.


"Pegasus (MVP)" <I....@fly.com.oz> wrote in message
news:uyjTbWqC...@TK2MSFTNGP05.phx.gbl...

Pegasus (MVP)

unread,
Aug 30, 2008, 7:57:53 PM8/30/08
to

"Tyler Durden" <ab...@antispam.org> wrote in message
news:u7sTaouC...@TK2MSFTNGP03.phx.gbl...

> Thank you, Pegasus. But the SendKeys method would be inadequate since the
> script, that would starts other applications too, could be run on non
> english XP installations.
>
> Do you know of any freeware, small executable to start applications in a
> maximized window?.

Sorry, I don't.


Al Dunbar

unread,
Aug 31, 2008, 12:22:59 PM8/31/08
to

"Pegasus (MVP)" <I....@fly.com.oz> wrote in message
news:%239yz8wv...@TK2MSFTNGP06.phx.gbl...

CMD.EXE can do that in most cases, i.e.:

start /max notepad.exe

This works for MMC.EXE as well:

Set WshShell = CreateObject("WScript.Shell")

WshShell.run "cmd.exe /c start /max mmc.exe", 0, False

Unfortunately, however, this does not work:

Set WshShell = CreateObject("WScript.Shell")

WshShell.run "cmd.exe /c start /max mmc.exe %windir%\system32\compmgmt.msc",
0, False


as the xml code in the .mmc file includes settings such as the window size.

If you want compmgmt.msc to always open maximized, you will have to open it
in author mode, maximize its window, and save it - either back to
%windir%\system32 or somewhere else.


/Al


Tyler Durden

unread,
Sep 1, 2008, 9:22:01 AM9/1/08
to
That's exactly what I mean, it's almost unbelievable that there is no neat
way to do this. And it's a very common administrative task that I have to
repeat on a lot of networked and standalone computers.


"Al Dunbar" <Alan...@hotmail.com.nospaam> wrote in message
news:e66O9z6C...@TK2MSFTNGP05.phx.gbl...

Al Dunbar

unread,
Sep 2, 2008, 1:36:45 AM9/2/08
to
LOL, there are a lot of things for which "there is no neat way to do this",
or, alternately, much of what is doable, is doable in a task-specific
manner.

But if you want compmgmt.msc to always open maximized on every computer, you
could make the change on one computer and copy the .msc file to all the
others - there is no need to open each .msc file in author mode on more than
one system.

/Al

"Tyler Durden" <ab...@antispam.org> wrote in message

news:uoxWGWDD...@TK2MSFTNGP04.phx.gbl...

\RemS

unread,
Sep 3, 2008, 4:51:00 AM9/3/08
to
'''''''''''''''''''''''''''''''
strCMD = "mmc.exe compmgmt.msc"

Set WshShell = CreateObject("Wscript.Shell")

With GetObject("winmgmts:Win32_Process")
Set oInParams = .Methods_("Create").InParameters.SpawnInstance_
oInParams.CommandLine = strCMD
Set oOutParams = .ExecMethod_("Create", oInParams)
strPID = oOutParams.ProcessId
returned = oOutParams.ReturnValue
End With

While WshShell.AppActivate(strPID) = FALSE
wscript.sleep 500
Wend

If returned = 0 Then
WshShell.AppActivate strPID
If WshShell.AppActivate(strPID) then _
WshShell.SendKeys "(% )" & "{DOWN}{DOWN}{DOWN}{DOWN}~"

Wsh.sleep 99 : WshShell.SendKeys("^")
End If
'''''''''''''''''''''''''''''''

As "Pegasus (MVP)" already wrote:
Note that the script is fragile like all scripts that involve the SendKeys

method. !


\Remco

Gilles LAURENT [MVP]

unread,
Sep 5, 2008, 1:45:42 PM9/5/08
to
"Tyler Durden" <ab...@antispam.org> a écrit dans le message de
news:u7sTaouC...@TK2MSFTNGP03.phx.gbl

Hi Tyler,

[...]


| Do you know of any freeware, small executable to start applications
| in a maximized window?.

My tool StartMax (freeware) is maybe what you need ;-)
http://glsft.free.fr/index.php?option=com_content&task=view&id=52&Itemid=28

--
Gilles LAURENT
MVP Windows Server - Admin Frameworks
http://glsft.free.fr


Tyler Durden

unread,
Sep 8, 2008, 11:24:50 AM9/8/08
to
Gilles,

I really thank you, that's *exactly* what I was looking for. Worked
perfectly, and I hope that helps someone else too (certainly will).

Thank you!


"Gilles LAURENT [MVP]" <gl...@free.fr> wrote in message
news:ek9p483D...@TK2MSFTNGP04.phx.gbl...

0 new messages