Hi
I want to sort our desktop icons by name as default for all our users. At the moment allot of peoples icons are all over the show. How can I achieve this please?
Thanks

Hi
I want to sort our desktop icons by name as default for all our users. At the moment allot of peoples icons are all over the show. How can I achieve this please?
Thanks
Last edited by FN-GM; 19th February 2008 at 12:06 AM.
Hi,
The settings for desktop icon placement in Windows XP are located in the the HKCU\Software\Microsoft\Windows\Shell\Bags\1\Deskt op registry key.
This registry key contains a number of values, the most relevant if which are the ItemPos<screenresolution> values, the Sort value and the FFlags value.
The sort value controls the sort order of the icons (by name, by type, by size etc.), the FFlags value controls the arrangement of the icons (align to grid, auto align etc.)
Finally there may be any number of ItemPos values (appended with different screen resolutions eg. ItemPos800x600), which contol the user defined positions of the icons for different screen resolutions.
So in order to reset a users desktop layout you would need to remove any ItemPos values and optionally set the FFlags and Sort values depending on your requirements.
The following vbs script should achieve this, if it is run as a logon script. (Appologies about the length of the script, but I've added a few comments to try and explain what is going on)
Or I guess you could just delete the whole HKCU\Software\Microsoft\Windows\Shell\Bags\1\Deskt op key and then the user should pick up the setting for the default user!Code:' ===================================== ' ' Script to reset desktop icon layout ' ' ===================================== ' declaire variables before use Option Explicit Dim strComputer, objReg, strKeyPath, arrValueNames, strValueName ' Hex value for HKEY_CURRENT_USER sub-tree Const HKEY_CURRENT_USER = &H80000001 ' Create a registry object for the local computer Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") ' Set which registry key we want to modify strKeyPath = "Software\Microsoft\Windows\Shell\Bags\1\Desktop" ' First test to see the the registry key exists If KeyExists(objReg,HKEY_CURRENT_USER,strKeyPath) Then ' Delete stored icon positions (ItemPos values) objReg.EnumValues HKEY_CURRENT_USER, strKeyPath, arrValueNames For Each strValueName in arrValueNames If (Left(strValueName,7) = "ItemPos") Then objReg.DeleteValue HKEY_CURRENT_USER, strKeyPath, strValueName End If Next ' Set the icon sort order ' Possible vaules for Sort DWord Value ' dword:0x00000000 = sort by name ' dword:0x00000001 = sort by size ' dword:0x00000002 = sort by type ' dword:0x00000003 = sort by modified strValueName = "Sort" objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, &H00000000 ' Set the icon auto arrangement / grid settings ' Possible vaules for FFlags DWord Value ' dword:0x00000220 = Auto Arrange off, Align to Grid off ' dword:0x00000221 = Auto Arrange on ' dword:0x00000224 = Auto Arrange off - align to Grid On ' dword:0x00000225 = Auto Arange on, Align to Grid on ' dword:0x00001220 = Hide Desktop Icons strValueName = "FFlags" objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, &H00000224 End If ' Function to test for the existance for a registry key ' <objReg> - Pointer to a registry object ' <strSubTree> - Which subtree to we want to search, ie HLKM, HKCU etc. ' <strKeyPath> - the registry key we want to search for. ' Returns: True if the <strKeyPath> registry key exists, False otherwise Private Function KeyExists(objReg, strSubTree, strKeyPath) Dim arrSubKeys, intErr intErr = objReg.EnumKey(strSubTree, strKeyPath, arrSubKeys) If intErr = 0 Then KeyExists = True Else KeyExists = False End If End Function
Hope that is of some help,
Iain.
FN-GM (19th February 2008)

When I setup/create a standard roaming profile, such as clicking on MS Office, Adobe Reader 8 etc... I always right click the desktop and choose Auto Arrange. This info is then stored in everyone's profile![]()
FN-GM (19th February 2008)

I am starting to do the "auto arrange" but we have 500 computers and we se local default profiles. So its allot of work.
I will have a try with the script tomorrow (if i get time)
Thanks

I agree that using the script would be more efficient in the circumstances!

Yer of course, i am doing it as a do them now.

I think I'd be in for all sorts of ear-ache if I tried rearranging people's icons!
The pupil desktop has a fixed unchangeable layout, so that doesn't need it. The staff one looks pretty when they logon for the first time, but what they choose to do to it afterwards is their problem.
I'm not sure who's being more anal here to have their icons arranged in such a manner.. the staff or the network admin![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)