Answered by:
Remove Windows Media Player pinned taskbar item

Question
-
Hi All,I was wondering if anyone knows a way to remove the default pinned windows media player from the taskbar with a script/GPO. The lnk files for the pinned items are saved in this folder:%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBarbut if you delete it there the icon will turn white and will no longer be accesible. When you try to click it an error pops up allowing you to remove the pinned item.This is probably because the pinned links are stored on the files system, but additional info on the pinned items is stored in a binary registry key:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\FavoritesResolveIs there a way I can do this with a script/GPO or API call somehow?Cheers, MichielWednesday, August 12, 2009 2:11 PM
Answers
-
Hi MichB,
Per the windows sdk for windows 7, a small set of applications are pinned by default for new installations. Other than these, only the user can pin further applications; programmatic pinning by an application is not permitted.
Therefore, I think the programmtic interface for adding/removing them are quite limited. As you mentioend that deleting items under
%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
is not complete, you can try using processMonitor to capture all the file/registry related activities to see whether there is anything else related to the taskbar item.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marked as answer by MichB Monday, August 17, 2009 11:44 AM
Friday, August 14, 2009 8:09 AM
All replies
-
Right click of any Taskbar icon I have shows "Unpin this program from the task bar" which I just did.
I then started it from Start menu, Right clicked its active taskbar icon & slected "Pin this icon to the task bar".
Why would you want script to do it? Don't answer this question if it answers your questionWednesday, August 12, 2009 4:58 PM -
Hi,Thanks for our answer.I'm creating images completely unattended so I would like to remove the windows media player pin automatically instead of pausing the image building process just to unpin wmp from the taskbar. It was a decision of management to have the wmp icon removed from the taskbar so I have to figure something out how to remove it programmatically.Cheers, MichielThursday, August 13, 2009 7:04 AM
-
In File you mention there is also Desktop.ini where in:
[LocalizedFileNames]
Windows Explorer.lnk=@%SystemRoot%\system32\shell32.dll,-22067
Media Center.lnk=@%systemroot%\ehome\ehres.dll,-100
Internet Explorer.lnk=@%windir%\System32\ie4uinit.exe,-731
Windows Media Player.lnk=@%SystemRoot%\system32\unregmp2.exe,-4Removal from here & the shortcut does not drop TBar icon in current session but would in next.
The Media player's Icon in Start shortcut:
{"C:\%ProgramFiles%\Windows Media Player\wmplayer.exe" /prefetch:1}When right clicked has Unpin from task bar or Pin to task bar depending on pinned staus,
this can be chosen without invoking Wmplayer.
In Registry: wmplayer.exe ? Unpin, Taskband Pin; ImplementsVerbs taskbarpin;taskbarunpinTrying it in CMD.EXE I do not know how the shortcut is being used to do this; for instance,
{"C:\Program Files\Windows Media Player\wmplayer.exe" /taskbarpin} runs the player but does not pin it to TBar
This added info. may help you if you know what to do with it. I do not.Thursday, August 13, 2009 11:25 AM -
Hi MichB,
Per the windows sdk for windows 7, a small set of applications are pinned by default for new installations. Other than these, only the user can pin further applications; programmatic pinning by an application is not permitted.
Therefore, I think the programmtic interface for adding/removing them are quite limited. As you mentioend that deleting items under
%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
is not complete, you can try using processMonitor to capture all the file/registry related activities to see whether there is anything else related to the taskbar item.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marked as answer by MichB Monday, August 17, 2009 11:44 AM
Friday, August 14, 2009 8:09 AM -
I don't know what Pin Unpin means to your process, but it could be avoided if you put Media Player shortcut into your own Taskbar or just had it on Desktop?Friday, August 14, 2009 12:01 PM
-
If you are using Sysprep and an .xml file from WSIM, under Microsoft-Windows-Shell-Setup > WindowsFeatures (add to pass 7 oobe System), there is an option to "ShowWindowsMediaPlayer". Set that to False, and Media Player will not appear on the Taskbar.
Now if anyone can tell me how to also remove Windows Explorer from the Taskbar, that would be great. WSIM does not have an option to "ShowWindowsExplorer".Tuesday, October 13, 2009 4:40 PM -
If you are using Sysprep and an .xml file from WSIM, under Microsoft-Windows-Shell-Setup > WindowsFeatures (add to pass 7 oobe System), there is an option to "ShowWindowsMediaPlayer". Set that to False, and Media Player will not appear on the Taskbar.
Now if anyone can tell me how to also remove Windows Explorer from the Taskbar, that would be great. WSIM does not have an option to "ShowWindowsExplorer".
Ukon,
Did you find an answer for this? I'd also like to do the same with the IE icon.Wednesday, March 17, 2010 10:19 PM -
Were you able to find a solution to remove Internet Explorer and Windows Explorer from the taskbar? Looks like MS produced an actual blog post on how to customize the start menu and taskbar but they mention that you can't. Kinda sucks not having a choice in the matter.
Thursday, April 15, 2010 9:29 PM -
I forget where I found this but this VB script works - usually (I'm also running it automatically after imaging process - since it has to run per user). originally I think it was written to add items but I've changed it to work to remove. so some of the comments may not be accurate... sorry for the inconsistencies if there are any but I'm too busy at the moment:
Option Explicit 'On Error Resume Next Dim blnPinned Dim blnTaskbar Dim i Dim intOpMode Dim objWshShell Dim objFSO Dim objShell Dim strPath Dim strArguments Dim strOptionsMessage ' Define constants Const CONST_ERROR = 0 Const CONST_WSCRIPT = 1 Const CONST_CSCRIPT = 2 Const CONST_SHOW_USAGE = 3 Const CONST_PROCEED = 4 Const CONST_STRING_NOT_FOUND = -1 Const CONST_FOR_READING = 1 Const CONST_FOR_WRITING = 2 Const CONST_FOR_APPENDING = 8 Const CONST_Success = 0 Const CONST_Failure = 1 Const TRISTATE_USE_DEFAULT = -2 Const TRISTATE_TRUE = -1 'Open the file as Unicode. Const TRISTATE_FALSE = 0 'Open the file as ASCII. blnTaskbar = False '***************************************************************************** '* Create Objects '***************************************************************************** Set objWshShell = CreateObject("Wscript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("Shell.Application") '******************************************************************** '* Check script host exe and parse command line '******************************************************************** 'Get the command line arguments For i = 0 to Wscript.arguments.count - 1 ReDim Preserve arrArguments(i) arrArguments(i) = Wscript.arguments.item(i) Next 'Check whether the script is run using CScript Select Case intChkProgram() Case CONST_CSCRIPT 'Do Nothing Case CONST_WSCRIPT WScript.Echo "Please run this script using CScript." & vbCRLF & _ "This can be achieved by" & vbCRLF & _ "1. Using ""CScript MODIFYUSERS.vbs arguments"" for Windows 95/98 or" & VbCrLf & _ "2. Changing the default Windows Scripting Host setting to CScript" & vbCRLF & _ " using ""CScript //H:CScript //S"" and running the script using" & vbCRLF & _ " ""MODIFYUSERS.vbs arguments"" for Windows NT." WScript.Quit Case Else WScript.Quit End Select 'Parse the command line Err.Clear() intOpMode = intParseCmdLine(arrArguments, strPath, blnTaskbar, strOptionsMessage) If Err.Number Then Wscript.Echo "Error 0X" & CStr(Hex(Err.Number)) & " occurred in parsing the command line." If Err.Description <> "" Then Wscript.Echo "Error description: " & Err.Description & "." End If 'WScript.quit End If Select Case intOpMode Case CONST_SHOW_USAGE Call ShowUsage() WScript.quit Case CONST_PROCEED 'Do nothing. Case CONST_ERROR WScript.quit Case Else Wscript.Echo "Error occurred in passing parameters." End Select '******************************************************************** '* Main Script '******************************************************************** WScript.Echo strOptionsMessage blnPinned = PinItem(strPath, blnTaskbar) WScript.Echo "Item unpinned: " & CStr(blnPinned) If blnPinned Then WScript.Quit(0) Else WScript.Quit(0) End If '******************************************************************** '* '* Function intChkProgram() '* '* Purpose: Determines which program is used to run this script. '* '* Input: None '* '* Returns: intChkProgram is set to one of CONST_ERROR, CONST_WSCRIPT, '* and CONST_CSCRIPT. '* '******************************************************************** Private Function intChkProgram() ON ERROR RESUME NEXT Dim i Dim j Dim strFullName Dim strCommand 'strFullName should be something like C:\WINDOWS\COMMAND\CSCRIPT.EXE strFullName = WScript.FullName If Err.Number then Wscript.Echo "Error 0x" & CStr(Hex(Err.Number)) & " occurred." If Err.Description <> "" Then Wscript.Echo "Error description: " & Err.Description & "." End If intChkProgram = CONST_ERROR Exit Function End If i = InStr(1, strFullName, ".exe", 1) If i = 0 Then intChkProgram = CONST_ERROR Exit Function Else j = InStrRev(strFullName, "\", i, 1) If j = 0 Then intChkProgram = CONST_ERROR Exit Function Else strCommand = Mid(strFullName, j+1, i-j-1) Select Case LCase(strCommand) Case "cscript" intChkProgram = CONST_CSCRIPT Case "wscript" intChkProgram = CONST_WSCRIPT Case Else 'should never happen Wscript.Echo "An unexpected program is used to run this script." Wscript.Echo "Only CScript.Exe or WScript.Exe can be used to run this script." intChkProgram = CONST_ERROR End Select End If End If End Function '******************************************************************** '* '* Function intParseCmdLine() '* '* Purpose: Parses the command line. '* '* Input: arrArguments An array containing input from the command line '* '* Input: strPath Path of exe to pin '* strOptionsMessage String containing options selected '* '* Returns: intParseCmdLine is set to one of CONST_ERROR, CONST_SHOW_USAGE, '* and CONST_PROCEED. '* '******************************************************************** Private Function intParseCmdLine(arrArguments, strPath, blnTaskbar, strOptionsMessage) ON ERROR RESUME NEXT Dim i Dim strFlag Dim strSwitchValue strFlag = arrArguments(0) Err.Clear() 'Help is needed If (strFlag = "") OR (strFlag="help") OR (strFlag="/h") OR (strFlag="\h") OR (strFlag="-h") _ OR (strFlag = "\?") OR (strFlag = "/?") OR (strFlag = "?") OR (strFlag="h") Then intParseCmdLine = CONST_SHOW_USAGE Exit Function End If strOptionsMessage = strOptionsMessage & "" & VbCrLf strOptionsMessage = strOptionsMessage & WScript.ScriptName & VbCrLf strOptionsMessage = strOptionsMessage & "" & VbCrLf strOptionsMessage = strOptionsMessage & "Command Line Options:" & vbCrLf strOptionsMessage = strOptionsMessage & "=======================================" & VbCrLf For i = 0 to UBound(arrArguments) strFlag = Left(arrArguments(i), InStr(1, arrArguments(i), ":")-1) If Err.Number Then 'An error occurs if there is no : in the string Err.Clear Select Case LCase(arrArguments(i)) Case "/q" blnQuiet = True strOptionsMessage = strOptionsMessage & "Supress Console Output: " & blnQuiet & VbCrLf Case "/taskbar" blnTaskbar = True strOptionsMessage = strOptionsMessage & "unPin to Taskbar instead of Start Menu: " & blnTaskbar & VbCrLf Case Else Wscript.Echo arrArguments(i) & " is not recognized as a valid input." intParseCmdLine = CONST_ERROR Exit Function End Select Else strSwitchValue = Right(arrArguments(i), Len(arrArguments(i))-(Len(strFlag)+1)) Select Case LCase(strFlag) Case "/item" strPath = strSwitchValue strOptionsMessage = strOptionsMessage & "Item to unpin to Start Menu or Taskbar: " & strPath & VbCrLf Case else Wscript.Echo "Invalid flag " & strFlag & "." Wscript.Echo "Please check the input and try again." intParseCmdLine = CONST_ERROR Exit Function End Select End If Next If (strPath = "") Then Wscript.Echo "The /item switch is required" Wscript.Echo "Please check the input and try again." intParseCmdLine = CONST_ERROR Exit Function End If intParseCmdLine = CONST_PROCEED End Function '******************************************************************** '* '* Function PinItem() '* '* Purpose: unPin item to the taskbar. '* '* Input: strlPath Path of exe to pin '* blnTaskbar unPin item to Taskbar instead of Start Menu if true '* '* Dependencies: objShell Shell.Application object '* objFSO File System object '* '* Returns: True if the shortcut is removed, else false '* '******************************************************************** Function PinItem(strlPath, blnTaskbar) On Error Resume Next Dim colVerbs Dim itemverb Dim objFolder Dim objFolderItem Dim strFolder Dim strFile If objFSO.FileExists(strlPath) Then '***** Do nothing, folder exists Else '***** Folder does not exist PinItem = False WScript.Echo "File to unpin does not exist." WScript.Echo "Please check the input and try again." Exit Function End If strFolder = objFSO.GetParentFolderName(strlPath) strFile = objFSO.GetFileName(strlPath) WScript.Echo "Folder: " & strFolder WScript.Echo "File: " & strFile Err.Clear Set objFolder = objShell.Namespace(strFolder) Set objFolderItem = objFolder.ParseName(strFile) ' ***** InvokeVerb for this does not work on Vista/WS2008 'objFolderItem.InvokeVerb("P&in to Start Menu") ' ***** This code works on Vista/WS2008 Set colVerbs = objFolderItem.Verbs If blnTaskbar Then For each itemverb in objFolderItem.verbs If Replace(itemverb.name, "&", "") = "Unpin from Taskbar" Then itemverb.DoIt Next Else For each itemverb in objFolderItem.verbs If Replace(itemverb.name, "&", "") = "Unpin from Start Menu" Then itemverb.DoIt Next End If If Err.Number = 0 Then PinItem = True Else PinItem = False End If End Function '******************************************************************** '* '* Sub ShowUsage() '* '* Purpose: Shows the correct usage to the user. '* '* Input: None '* '* Output: Help messages are displayed on screen. '* '******************************************************************** Sub ShowUsage() WScript.Echo "This script is used to unPin items to the Taskbar." WScript.Echo "" WScript.Echo "Usage: cscript " & WScript.ScriptName & " [options]" WScript.Echo "" WScript.Echo "Options:" WScript.Echo "" WScript.Echo " /item:<PathName> Path of item to pin." WScript.Echo "" WScript.Echo " /taskbar (Optional) Pin to Taskbar instead of Start Menu." WScript.Echo "" WScript.Echo " /? (Optional) Displays this help text." WScript.Echo "" WScript.Echo "" WScript.Echo "" End Sub
and you can run it like so:
cscript "\\server\share\UnPinItem.vbs" /item:"%ProgramFiles%\Windows Media Player\wmplayer.exe" /taskbar
Lawfirm IT guyWednesday, April 28, 2010 7:17 PM -
you can use a script like this to modify superbar or start menu pinto
Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_PROGRAMS = &H2
Set objShell = CreateObject("Shell.Application")
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
Set objUsersProgramsFolder = objShell.NameSpace(CSIDL_PROGRAMS)strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
strUsersProgramsPath = objUsersProgramsFolder.Self.Path
' For Office 2007 Applications
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")Set objFolderItem = objFolder.ParseName("Microsoft Office Outlook 2007.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
NextSet objFolderItem = objFolder.ParseName("Microsoft Office Outlook 2007.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
NextSet objFolderItem = objFolder.ParseName("Microsoft Office Excel 2007.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
NextSet objFolderItem = objFolder.ParseName("Microsoft Office Word 2007.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
NextSet objFolderItem = objFolder.ParseName("Microsoft Office PowerPoint 2007.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next' For DM
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")' For Internet Explorer
Set objFolder = objShell.Namespace(strUsersProgramsPath)
Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next
Jay Parekh Project Leadership AssociatesWednesday, May 11, 2011 2:23 PM -
If you are using Sysprep and an .xml file from WSIM, under Microsoft-Windows-Shell-Setup > WindowsFeatures (add to pass 7 oobe System), there is an option to "ShowWindowsMediaPlayer". Set that to False, and Media Player will not appear on the Taskbar.
Note that the ShowWindowsMediaPlayer setting removes WMP ENTRY POINTS. So it will also remove the icon from the start menu.
Now if anyone can tell me how to also remove Windows Explorer from the Taskbar, that would be great. WSIM does not have an option to "ShowWindowsExplorer".Moo.
Friday, February 17, 2012 3:22 PM -
Right click of any Taskbar icon I have shows "Unpin this program from the task bar" which I just did.
I then started it from Start menu, Right clicked its active taskbar icon & slected "Pin this icon to the task bar".
Why would you want script to do it? Don't answer this question if it answers your questionBecause some of us need to prepare machines for use in
a business. Try removing this manually on a couple thousand machines.Thursday, March 22, 2012 5:34 PM -
Create a GPP: User Configuration - Preference - Windows Settings - Files - New File
Set action to "Delete"
Delete Files: C:\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Media Player.lnk
In Common: Apply once and do not reapply. (So if a user wants to put it back)
Far easier than all these scripts.
- Edited by Craig COoksey Wednesday, May 15, 2013 9:46 AM
- Proposed as answer by dstones Friday, July 5, 2013 6:46 PM
- Unproposed as answer by dstones Friday, July 5, 2013 6:46 PM
Wednesday, May 15, 2013 9:46 AM -
Create a GPP: User Configuration - Preference - Windows Settings - Files - New File
Set action to "Delete"
Delete Files: C:\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Media Player.lnk
In Common: Apply once and do not reapply. (So if a user wants to put it back)
Far easier than all these scripts.
This seems to accomplish the task partially, but the icon seems to stay visible in the task bar. When a user clicks on it for the first time, a message pops up stating: Can't open this item - "It might have been moved, renamed, or deleted. Do you want to remove this item?" If you click yes, the link on the task bar goes away. Sure, that works, but for the anything but savvy user, this is going to alert them and cause calls to the helpdesk.
Have you found a way to simply remove the taskbar icon for the user as well?
- Edited by dstones Friday, July 5, 2013 6:52 PM rewording
Friday, July 5, 2013 6:51 PM -
Spot on! In My windows 7 unattend, this also gives the option to hide the IE and the MediaCentre Icon.
Friday, January 26, 2018 1:37 PM