Get the all programs on alphabet again Print E-mail
Written by Hans Straat, Wednesday, 24 May 2006

When you implement a new environment you get your start > all programs fresh from the start. After working several weeks you get the job to implement a new program to the servers.

Now your start menu goes like a,b,d,a etc because the last installed program will show up last. Manually you can delete they registry key HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder and delete all the subfolders under it.  Doing this for 5 users may be fine but what if you have 1500 users complaining about the start menu, are you willing to delete the key one at a time?

Deleting the key with regdelete using a vbscript won't work because there are folders under the rootkey which are not empty. We found a solution on the internet developed by a microsoft scripting mvp and slightly changed the script. The script has been tested on a windows 2003 terminal server and a windows XP pro workstation but should work on all operating systems from microsoft.

This script will not check if it has already performed his action it will simply redo the action by deleting the values and folders under HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder again. If you only want to run it once you have to edit the script before running it.

Test the script before implementing it in a production environment is always my advice cause we are human and can make mistakes..

Da script

Option Explicit
'this script is written by a Microsoft MVP scripting guy
'we forgot his name when we found this script on the internet
'no credits go to datacrash for this script
'script has been altered slightly to keep the \menuorder folder

Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_DYN_DATA = &H80000006

Dim RegHive
Dim RegKey

'Select registry hive constant from above list.
RegHive = HKEY_CURRENT_USER
'Path to key to delete (no leading/trailing slashes).
' RegKey = " Software\Microsoft\Windows\CurrentVersion\Policies"
RegKey="Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder"

'Recursive sub to delete all subkeys and parentkey.
Call DelKey( RegHive, RegKey)
' wscript.echo "Done!"

Sub DelKey(RegRoot, SPath)
    Dim sKeys
    Dim SubKeyCount
    Dim objRegistry
    Dim lRC
    Dim lRC2
    Dim Key
    Set objRegistry = GetObject("winmgmts:root\default:StdRegProv")

    'wscript.echo "ENUMERATING KEY: " & sPath & "\" & Key
    lRC = objRegistry.EnumKey(RegRoot, sPath, sKeys)

    If IsArray(sKeys) Then
       For each Key in sKeys
           Call DelKey( RegRoot, SPath & "\" & Key )
       Next
    End If
    If RegKey <> SPath Then
       wscript.echo "DELETING KEY: " & sPath
       '====> uncomment to go live !!!!!!!!!!!!!!
      lRC2 = objRegistry.DeleteKey(RegRoot, sPath)
       'If (lRC2 = 0) Then
           'wscript.echo "Success!"
       'Else
           'wscript.echo "Error!"
       'End If
    End If
End Sub

 

 

 

Comments
Add NewSearchRSS
Write comment
Name:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 

Powered by JoomlaCommentCopyright (C) 2006 Frantisek Hliva. All rights reserved.Homepage: http://cavo.co.nr/

 
< Prev   Next >