Jump to content

GPEdit.msc wont start hidden


Recommended Posts

On a 2k3 DC, AutoIt 3.3.0.0, the following line launches mmc.exe hidden, as expected:

ShellExecute("mmc.exe", "", "", "", @SW_HIDE)

The following always brings mmc/gpedit into focus and doesn't hide it:

ShellExecute("gpedit.msc", "", "", "", @SW_HIDE)

ShellExecute("mmc.exe", "gpedit.msc", "", "", @SW_HIDE)

I've tried using 'Run' as well, no cigar.

Ideas or suggestions? TIA

Link to comment
Share on other sites

Works for me:

#RequireAdmin

Run("gpedit.msc", "", @SW_HIDE)

That doesn't work, I thought .msc files are loaded by mmc.exe therefore 'Run' will do nothing.

My code was

Run("mmc.exe gpedit.msc", "", @SW_HIDE)

which will load in full view, not hidden. Just loading mmc.exe will load hidden.

Did you try it on Server 2003?

Any other tips?

Link to comment
Share on other sites

I tried it on Windows 7, where it works just fine. Just tried it on again on Windows Vista where it doesn't work. I've found that the run mechanism in Windows 7 changed quite a bit.

As a workaround I can suggest this:

#RequireAdmin

ShellExecute("gpedit.msc")
WinWait("Local Group Policy Editor")
WinSetState("Local Group Policy Editor", "", @SW_HIDE)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...