Phylum Posted March 12, 2010 Posted March 12, 2010 (edited) I'm preparing an image and I'd like to pin some of the more frequently used applications to the Task Bar and Start Menu as we did with the Quick Launch bar in Windows XP. (We don't want to use the Quick Launch Bar; we want our users to leverage Windows 7's built-in features, and why not?)I haven't found much on this subject, but from probing around, it appears that applications pinned to the Start Menu and the Task Bar are stored in:C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenuC:\Users\%USERNAME%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBarOn the assumption that the location above is correct, if I want to apply a specific configuration to all users, would ICreate C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu (since it doesn't exist by default)Create C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar (again, doesn't exist)Copy the files from a preconfigured profile into the newly created 'Default User' foldersIn addition, I'm looking to remove certain items that show up on the Start Menu & Task Bar by default, like Windows Media Player & Explorer for starters, and adding the Switch between Windows ('Flip 3-D') button that was present in Vista, but removed in Windows 7. (Users might find it handy to click a button then use left/up or down/right or the mouse scroll wheel to flip through apps vs dealing with two buttons. )I've researched the 'Default User' copy profile issue, found a number of blogs and instructions online, even from other forums,http://windowsteamblog.com/blogs/springboard/archive/2009/10/30/configuring-default-user-settings-full-update-for-windows-7.aspxhttp://support.microsoft.com/kb/973289http://www.sd61.bc.ca/windows2000/VistaWin7/Profiles.htmlhttp://copyprofile.blogspot.com/2009/12/sysprep-with-copyprofile-setting-right.htmlhttp://joeelway.spaces.live.com/blog/cns!2095EAC3772C41DB!2708.entry?sa=774324192http://blog.brianleejackson.com/sysprep-a-windows-7-machine-%E2%80%93-start-to-finish-v2 (and v1)But, they didn't specificaly say whether or not the customizations I wanted to make would follow.How do I go about setting this up? Has this been done before?Do I try the 'enabler' workaround and try to copy the Administrator profile over the Default profile? (Will it really work?)Just seeking instruction & confirmation. Edited May 17, 2010 by Phylum
maxXPsoft Posted March 12, 2010 Posted March 12, 2010 I do that to the start menu with my app but taskbar I haven't been able to do even with someones vbs script.I use attrib cmds on these cause they are hidden and must be setup same way, open folder and you'll see what I mean, mess up and it's not pretty if you are just going to copy then maybe it will work.I copy C:\Users\YOURNAME\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenuI also export a reg file HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage2 but those are specific settings like Windows Explorer set the way I like itI use cmd files to do these things right now but was looking at OEM folders cause I seen 1 oem place things there.
Phylum Posted March 17, 2010 Author Posted March 17, 2010 (edited) Thanks for the reply.Per at least one, if not more, of the links I included, they advised against that action:* - Coping a customized profile, and associated registry entries, over to the Default profile.The primary reason was because of the hard-coded user GUID (I believe) that's still associated with files & registry settings copied.Although setting the copyprofile to true in the unattend.xml does seem to get the majority of the settings, several obvious items, and presumably many more less obvious ones, remain incorrectly configured - that is to say the Windows 7 default vs what I want it to be. My guess is that the pinned taskbar & start menu objects are not only updated on the file system somewhere, perhaps in the location I listed in my previous post, but also, a binary registry entry may be updated as well to include the new application this making these types of changes difficult to identify. Edited March 17, 2010 by Phylum
Phylum Posted May 17, 2010 Author Posted May 17, 2010 (edited) To say 'there's nothing I hate more than someone saying "I fixed it" or "I found the solution" in a forum and not post the solution' would be a lie as there are many, many, things competing for that same level of hate. (Ok so hate is a strong word, but darn it people it makes it nearly impossible for others to learn or otherwise solve their issues when you don't circle back with confirmation that suggestions worked, or if you found something on your own.)I'm very much pro-open source and sharing the wealth of knowledge, following my Father's example, so I've circled back to close the loop.So, for what its worth I believe I have found a solution to this...For starters, if you want XYZ apps pinned to the start menu or taskbar, you'll need to create a script that invokes the Pin command on the apps in question. I decided an array was the simplest thing to do. This script runs during the users first logon and is called via wscript because I don't need them seeing a dos box or clicking 'OK' on every echo. I feel this process is very slow and will explore a PoSH alternative/replacement. This was found online and I modified to suit.'=========================================================================='' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2009'' NAME: Pin & Unpin items to/from Start Menu & Taskabar'' AUTHOR: Phylum , ' DATE : 4/8/2010'' COMMENT: ''==========================================================================Dim sPath, sPinSMArray, sPinTBArray, sUnpinTBArray, PinItemDim sMOW, sMOO, sFOX, sLN, sNuance, siMAN, sEXP, sWMPConst CSIDL_COMMON_PROGRAMS = &H17 Const CSIDL_PROGRAMS = &H2 Set fso = CreateObject("Scripting.FileSystemObject")Set oShell = CreateObject("Shell.Application") Set wshshell = CreateObject("WScript.Shell")Set oAllUsersProgramsFolder = oShell.NameSpace(CSIDL_COMMON_PROGRAMS)sPath = oAllUsersProgramsFolder.Self.Path & "\"sMOW = "Microsoft Office Word 2007.lnk"sMOO = "Microsoft Office Outlook 2007.lnk"sFOX = "Mozilla Firefox.lnk"sLN = "Notes.lnk"sNuance = "Nuance PDF Professional 6\PDF Converter Professional.lnk"siMAN = "iManage.lnk"sEXP = wshshell.ExpandEnvironmentStrings("%WinDir%") & "\Explorer.exe"sWMP = wshshell.ExpandEnvironmentStrings("%ProgramFiles%") & "\Windows Media Player\wmplayer.exe"sPinSMArray = Array(sLN,sFOX,sMOO,sMOW,sNuance,siMAN)sPinTBArray = Array(sMOO,sMOW,sFOX,siMAN)sUnpinTBArray = Array(sEXP,sWMP)dim strScriptHost, output_echostrScriptHost = LCase(Wscript.FullName)If Right(strScriptHost, 11) = "wscript.exe" Then output_echo = FalseElse output_echo = TrueEnd IfDim itemFor Each item In sPinSMArray If Not fso.FileExists(sPath & item) Then PinItem = False debugecho "File, " & item & ", to pin does not exist in " & sPath & "." debugecho "Please check the input and try again." 'WScript.quit Else PinSM(sPath & item) End IfNextFor Each item In sPinTBArray If Not fso.FileExists(sPath & item) Then PinItem = False debugecho "File, " & item & ", to pin does not exist in " & sPath & "." debugecho "Please check the input and try again." 'WScript.quit Else PinTB(sPath & item) End IfNextFor Each item In sUnpinTBArray If Not fso.FileExists(item) Then PinItem = False debugecho "File, " & item & ", to unpin does not exist in " & sPath & "." debugecho "Please check the input and try again." 'WScript.quit Else UnpinTB(item) End IfNextFunction PinSM(shortcut) Set fso = CreateObject("Scripting.FileSystemObject") Set oShell = CreateObject("Shell.Application") sFolder = fso.GetParentFolderName(shortcut) sFile = fso.GetFileName(shortcut) debugecho "Pinning " & sFolder & "\" & sFile & " to Start Menu." Err.Clear Set oFolder = oShell.NameSpace(sFolder) Set oFolderItem = oFolder.ParseName(sFile) Set colVerbs = oFolderItem.Verbs For Each itemverb In oFolderItem.Verbs If Replace(itemverb.name, "&", "") = "Pin to Start Menu" Then itemverb.DoIt NextEnd FunctionFunction PinTB(shortcut) Set fso = CreateObject("Scripting.FileSystemObject") Set oShell = CreateObject("Shell.Application") sFolder = fso.GetParentFolderName(shortcut) sFile = fso.GetFileName(shortcut) debugecho "Pinning " & sFolder & "\" & sFile & " to Taskbar." Err.Clear Set oFolder = oShell.NameSpace(sFolder) Set oFolderItem = oFolder.ParseName(sFile) Set colVerbs = oFolderItem.Verbs For Each itemverb In oFolderItem.Verbs If Replace(itemverb.name, "&", "") = "Pin to Taskbar" Then itemverb.DoIt NextEnd FunctionFunction UnpinTB(shortcut) Set fso = CreateObject("Scripting.FileSystemObject") Set oShell = CreateObject("Shell.Application") sFolder = fso.GetParentFolderName(shortcut) sFile = fso.GetFileName(shortcut) debugecho "Unpinning " & sFolder & "\" & sFile & " from Taskbar." Err.Clear Set oFolder = oShell.NameSpace(sFolder) Set oFolderItem = oFolder.ParseName(sFile) Set colVerbs = oFolderItem.Verbs For Each itemverb In oFolderItem.Verbs If Replace(itemverb.name, "&", "") = "Unpin from Taskbar" Then itemverb.DoIt NextEnd FunctionFunction debugecho(msg) if output_echo Then wscript.echo msg end ifend FunctionThere are loads of useless icons on the Start Menu that are seemingly impossible to remove, like Sticky Notes, displaySwitch, Calculator etc. After scouring the file system for ages and checking and rechecking the registry and combing Google et al, I uncovered that the aforementioned shortcuts (and others) listed on the Start Menu are located in:HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssistThere are two GUIDs in that location but they're 'encrypted', albeit very poorly. Microsoft decided to use the ol' rot13 encryption for the entries for whatever reason.Encrypting/Decrypting something with ROT13 is very simpleFunction Rot13Fixer(sString) Dim n, i, StringROT For i=1 To Len(sString) ' We don't want to convert numbers. If Not IsNumeric(Mid(sString,i,1)) Then individual_asc = Asc(Mid(sString,i,1)) 'WScript.Echo "IASC: " & Chr(individual_asc) & " (" & individual_asc & ")" If individual_asc >= 97 And individual_asc <=109 Then individual_asc = individual_asc +13 'WScript.Echo "IASC+13.1: " & Chr(individual_asc) & " (" & individual_asc & ")" Else If individual_asc >= 110 And individual_asc <= 122 Then individual_asc = individual_asc -13 'WScript.Echo "IASC-13.1: " & Chr(individual_asc) & " (" & individual_asc & ")" Else If individual_asc >= 65 And individual_asc <= 77 Then individual_asc = individual_asc +13 'WScript.Echo "IASC+13.2: " & Chr(individual_asc) & " (" & individual_asc & ")" Else If individual_asc >= 78 And individual_asc <= 90 Then individual_asc = individual_asc -13 'WScript.Echo "IASC-13.2: " & Chr(individual_asc) & " (" & individual_asc & ")" End If End If End If End If StringROT = StringROT + Chr(individual_asc) Else StringROT = StringROT + Mid(sString,i,1) End If 'WScript.Echo StringROT Next Rot13Fixer = StringROTEnd FunctionNow that I can properly decrypt Rot13, and as such the contents of that registry location, I don't have to worry about hard coding GUID's, which probably change from machine to machine, in the script. The following functions read the path, enumerate the Keys then enumerate the Values under each key decrypting accordingly.Function EnumKeys(HKEY,Path) Dim EKHKPath, GUIDPath, arrSubKeys, i Select Case HKEY Case "HKCU", "HKEY_CURRENT_USER" Const HKCU = &H80000001 EKHKPath = HKCU Case "HKLM", "HKEY_LOCAL_MACHINE" Const HKLM = &H80000002 EKHKPath = HKLM Case "HKU", "HKEY_USERS" Const HKU = &H80000003 EKHKPath = HKU Case "HKCR", "HKEY_CLASSES_ROOT" Const HKCR = &H80000000 EKHKPath = HKCR Case "HKCC", "HKEY_CURRENT_CONFIG" Const HKCC = &H80000005 EKHKPath = HKCC Case "HKDD", "HKEY_DYN_DAT" Const HKDD = &H80000006 EKHKPath = HKDD Case Else WScript.Echo "ERROR: Invalid HKEY Type Specified (" & EKHKPath & ")" WScript.echo "Please use HKCU, HKLM etc, or the long name equivalent." WScript.Sleep(15000) WScript.Quit End Select Set objReg=GetObject("winmgmts:\\.\root\default:StdRegProv") objReg.EnumKey EKHKPath, Path, arrSubKeys if isarray(arrSubKeys) Then For i=0 to UBound(arrSubKeys) GUIDPath = Path & "\" & arrSubKeys(i) & "\Count" 'WScript.Echo "GuidPath: " & GUIDPath EnumValues HKEY,GUIDPath Next end IfEnd FunctionFunction EnumValues(HKEY,Path) Dim EVHKPath, arrValueNames, arrValueTypes, i const REG_SZ = 1 const REG_EXPAND_SZ = 2 Const REG_BINARY = 3 Const REG_DWORD = 4 Const REG_MULTI_SZ = 7 Select Case HKEY Case "HKCU", "HKEY_CURRENT_USER" Const HKCU = &H80000001 EVHKPath = HKCU Case "HKLM", "HKEY_LOCAL_MACHINE" Const HKLM = &H80000002 EVHKPath = HKLM Case "HKU", "HKEY_USERS" Const HKU = &H80000003 EVHKPath = HKU Case "HKCR", "HKEY_CLASSES_ROOT" Const HKCR = &H80000000 EVHKPath = HKCR Case "HKCC", "HKEY_CURRENT_CONFIG" Const HKCC = &H80000005 EVHKPath = HKCC Case "HKDD", "HKEY_DYN_DAT" Const HKDD = &H80000006 EVHKPath = HKDD Case Else WScript.Echo "ERROR: Invalid HKEY Type Specified (" & EVHKPath & ")" WScript.echo "Please use HKCU or the long name equivalent, HKEY_LOCAL_MACHINE." WScript.Sleep(15000) WScript.Quit End Select Set oReg=GetObject("winmgmts:\\.\root\default:StdRegProv") oReg.EnumValues EVHKPath, Path, arrValueNames, arrValueTypes if isarray(arrValueNames) Then For i=0 to UBound(arrValueNames) 'WScript.Echo "Unencrypted Value Name: " & arrValueNames(i) arrValueNames(i) = Rot13Fixer(arrValueNames(i)) 'WScript.Echo "Value Name: " & arrValueNames(i)' #region Disabled code' Select Case arrValueTypes(i)' Case REG_SZ' WScript.Echo "Data Type: String"' Case REG_EXPAND_SZ' WScript.Echo "Data Type: Expanded String"' Case REG_BINARY' WScript.Echo "Data Type: Binary"' Case REG_DWORD' WScript.Echo "Data Type: DWORD"' Case REG_MULTI_SZ' WScript.Echo "Data Type: Multi String"' End Select' #endregion 'WScript.Echo "this: " & HKEY & " " & Path & " " & arrValueNames(i) FixStartMenu HKEY, Path, arrValueNames(i) Next End IfEnd FunctionFrom there I call yet another function to remove the entries that match (InStr()) words stored in an array.Example:mylist = Array("snippingtool","calculator",..."displayswitch")For each item in Array If ((Instr(1,RegPath,mylist,1) > 0) Then delete the registry key End ifNextThank you Jesus! Edited May 19, 2010 by Phylum
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now