Jump to content

Start menu sort Alphabetically?


Recommended Posts

@BFCF

For my unattended install, the MenuOrder key does not exist at T-12 anyway (see here) so removing the MenuOrder key via cmdlines.txt and a regtweak is futile.  This is probably the case for you too.  I used this techinique to sort it permanently and unattended too!

- jimanny

I would like to try your method but honestly i can't see how to make it work... :(

How i launch vbs files? And when? Can you make a tutorial more simple?

I would apreciate.

Thanks.

Link to comment
Share on other sites

  • 1 year later...

I've been playing around with this issue for a bit now and I'll share what I've learned - hopefully it will help someone.

It's been my experience that removing the MenuOrder key does work for a normal install, but only for so long. That is manually install windows, log in, remove the key, and restart. It seems that eventually something happens and it ends up unsorted again.

For my unattended install project, I've tried removing the key at T-12 as others have suggested with no luck.

Then I came across this at theeldergeek which explains how to sort alphabetically by restricting the permissions on the MenuOrder key. This one has worked great for me for a manual install - now to implement it unattended.

Here's what I done which works for me using RegPerm:

AlphabetizeStartMenu.vbs:

Option Explicit

' Usage:

'    AlphabetizeStartMenu.vbs <drive> <user>

' Example:

'    AlphabetizeStartMenu.vbs D: NewUser


dim oWS, oFS, oArgs, regperm, user, drive
dim runonceex, menuorder, usersstring

set oWS = WScript.CreateObject("WScript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")

set oArgs = WScript.Arguments
drive = oArgs(0)
regperm = drive & "\Tweaks\Tools\regperm.exe /K"
user = oArgs(1)

runonceex = "\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\"
menuorder = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder"
usersstring = "/A:Administrators:R /A:" & user & ":R /A:RESTRICTED:R /A:System:F /F /I /Q"

'set permissions on MenuOrder key to prevent reordering
'these are set with RunOnceEx just after the new user is logged in
oWS.RegWrite "HKLM" & runonceex & "Title","Alphabetize the Start Menu"
oWS.RegWrite "HKLM" & runonceex & "Flags",20,"REG_DWORD"

oWS.RegWrite "HKLM" & runonceex & "install01\","Create MenuOrder Key"
oWS.RegWrite "HKLM" & runonceex & "install01\1",drive & "\Tweaks\Tools\CreateMenuOrderKey.vbs"

oWS.RegWrite "HKLM" & runonceex & "install02\","Add RegPerm Command Line"
oWS.RegWrite "HKLM" & runonceex & "install02\1",regperm & " " & menuorder & " " & usersstring

CreateMenuOrderKey.vbs

Option Explicit

dim oWS, oFS

set oWS = WScript.CreateObject("WScript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")

'create MenuOrder key
oWS.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\", "", "REG_SZ"

I'm actually calling AlphabetizeStartMenu.vbs from a WIHU interface which comes up using RunOnceEx right after I first logon as administrator. The WIHU command sends the CDROM drive letter it finds and new user name that I create with WIHU. BTW, the WIHU install.ini section looks like this for reference:

[Registry Tweaks]
selected = 1
collapsed = 1

description.0 = Keep the Start Menu alphabetic
command.0 = %SRCDRIVE%\Tweaks\Tools\AlphabetizeStartMenu.vbs %SRCDRIVE% %NewUserName%
selected.0 = 1

This is working perfect for me now! After I logon as the newly created user, the start menu is perfectly ordered and I am not able to reorder it by dragging. :thumbup

I have not tried this without WIHU but it's my guess that if AlphabetizeStartMenu.vbs <drive> <user> was added to RunOnceEx at T-12 it would work as long as <user> existed at the time of the first logon. Perhaps you could create the user with a batch file and a reg file like here. Then, after you logon again, the MenuOrder key permissions would be set for the user specified.

Want to know more? The reason I'm creating the MenuOrder key from AlphabetizeStartMenu.vbs is because I discovered that the key does not exist until after the user is fully logged in - well after RunOnceEx command executes. So basically RegPerm could not set the permissons on a key that did not exist. I discovered this by adding some debug code to the bottom of AlphabetizeStartMenu.vbs:

oWS.RegWrite "HKLM" & runonceex & "install03\","Echo Command Line"
oWS.RegWrite "HKLM" & runonceex & "install03\1","cmd.exe /k @echo " & regperm & " " & menuorder & " " & usersstring

This basically confirmed that the RegPerm command line was correct during RunOnceEx by showing it in a DOS box. It also prevented RunOnceEx from completing so from the same DOS box, I simply started regedit and found the MenuOrder key was not yet created. Then I closed the DOS box and refreshed regedit every second while windows finished it's startup routines with me logged in as the new user. Guess what - MenuOrder never showed up! But it did show up as soon as I dragged an item around in the start menu. I found this very interesting.

As a result, I'm not sure why removing the MenuOrder key at T-12 seems to work for some because for my install, the key already does not exist at that time anyway.

I would be happy to know if you found this info useful.

The End

- jimanny

I have a quick question. Are you saying that I should copy those examples into notepad and save it under those file names right?

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

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
  • Recently Browsing   0 members

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