
Of course, you can use PowerShell to deploy the Taskbar with a script, and you can also use the above command during OS deployment, such as with Configuration Manager. Then log on to the computer with a user account that has no profile on the machine, and the Taskbar modifications should be applied. Import-StartLayout -layoutpath C:\temp\layoutfile.xml -Mountpath C:\ The easiest way to test if your XML file works as intended is to use the PowerShell cmdlet Import-StartLayout as a local administrator: Then add the line below to the Taskbar.xml file:.In my example, I have added the Messaging app and Internet Explorer to the Taskbar. If we delete them, we can add them back again using the same. We have the option to either keep the default pinned apps (Edge, Store, and File Explorer) or delete them. I hope this script is useful to any system administrators wanting to easily manage user pinned items.
#Unpin edge from taskbar for all users code#
It binds to the folder used for the user pinned items to a location, and performs the verb “Unpin from ” on each file in that location.The final block of code in that section takes care of the pinning or unpinning of individual items from the specified location, again by performing the verb “Pin to ” or “Unpin from ” on each file path specified.įinally, we close out the For and If statements used within the code. The first 15 lines of that code block take care of the special case requirement to unpin all items from the specified location. WScript.Echo "Could not find " & strFilePath WScript.Echo "Unable to " & strMode & " " & strFilePath & _ Set objFile = objFSO.GetFile(strFilePath) If objFSO.FileExists(strFilePath) = True Then If LCase(Replace(objVerb.name, "&", "")) = strVerb Then Set objFolderItem = objFolder.ParseName(objFile.Name) Set objFolder = objShellApp.Namespace(objFile.ParentFolder & "\")

'Set objFile = objFSO.GetFile(objFile.Path) "\Microsoft\Internet Explorer\Quick Launch\User Pinned\" & _įor Each objFile In objFSO.GetFolder(strPinLocation).Files StrPinLocation = objShell.ExpandEnvironmentStrings("%APPDATA%") & _ If LCase(strFilePath) = "unpin_all" And strMode = "unpin" Then StrMessage = " has been " & strMode & "ned from the " & strLocation & "."Įnd If For Each strFilePath In arrFileNames

StrVerb = LCase(strMode & " from " & strLocation) StrMessage = " has been " & strMode & "ned to the " & strLocation & "." StrVerb = LCase(strMode & " to " & strLocation) Please set to ""Start Menu"" or ""Taskbar""." Please set to ""pin"" or ""unpin""."ĮlseIf LCase(strLocation) "start menu" And LCase(strLocation) "taskbar" Then If LCase(strMode) "pin" And LCase(strMode) "unpin" Then Set objShell = CreateObject("WScript.Shell")ĪrrLocations = Array("Start Menu", "Taskbar")Įnd If For Each strLocation In arrLocations Set objShellApp = CreateObject("Shell.Application")

StrLocation = arrActions(intAction + 1) Set objFSO = CreateObject("Scripting.FileSystemObject") StrMode = arrActions(intAction) 'strLocation can be "Start Menu" or "Taskbar" or "Both" ) For intAction = 0 To (UBound(arrActions) - 2) Step 3 arrFileNames = Array(arrActions(intAction + 2)) 'strMode can be "Pin" or "Unpin" "pin", "Taskbar", "C:\Windows\Calc.exe" _ "pin", "Start Menu", "C:\Windows\Notepad.exe", _ ' SYNTAX IS, , WITH THREE ELEMENTS PER ACTION ' all items from the Taskbar or Start Menu. ' If strMode = "unpin", you can use "unpin_all" in the third element of the array to unpin ' "Taskbar" to specify the target of each operation. ' The second element on each line of the array can be either "Both", "Start Menu", or ' Specify the file paths of the file to pin or unpin The code went through a few iterations, but I ended up with this version, which is a very flexible version for system administrators. The script I have developed allows the user to modify only one section of the code, in which they detail the operation, the target, and the shortcut to be created, all at once, so multiple operations can be performed with one run of the script. Many scripts will target either the unpin or pin operation, and usually only target one location (either the Start Menu or Taskbar) without requiring modification of the script to target the other. I have developed a script in VBScript that goes a long way to making this task as easy as possible.
#Unpin edge from taskbar for all users windows 7#
I have seen many people talk about a requirement to efficiently and easily pin and unpin items from the Start Menu and Taskbar for users on Windows 7 operating systems.
