4

I'm using PowerShell and a Chocolatey cmdlet Install-ChocolateyPinnedTaskBarItem and attempting to pin the Hyper-V Manager shortcut to the Windows taskbar. This is a 64 bit installation of Windows.

enter image description here

Normally you can call:

Install-ChocolateyPinnedTaskBarItem "$env:programfiles\Notepad++\notepad++.exe"

We know it's virtmgmt.msc. When you inspect its existing taskbar shortcut, you see that it's:

%windir%\system32\mmc.exe "%windir%\system32\virtmgmt.msc"

I've attempted to use the built-in $env:windir:

Install-ChocolateyPinnedTaskBarItem '$env:WinDir\system32\mmc.exe "$env:WinDir\system32\virtmgmt.msc"'

This fails with:

'$env:WinDir\system32\mmc.exe "$env:WinDir\system32\virtmgmt.msc"' does not exist, not able to pin to task bar

How can I pin an MMC shortcut like Hyper-V manager to the taskbar using Install-ChocolateyPinnedTaskBarItem? Should I use plain old windir%?

enter image description here

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
p.campbell
  • 98,673
  • 67
  • 256
  • 322
  • I don't use that function but looked at it here, https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/helpers/functions/Install-ChocolateyPinnedTaskBarItem.ps1 maybe its related to the split path function and the fact that you are passing the mmc.exe a variable for the snapin. Kind of looks like it would not handly anything other than a simple exe path. – ATek Feb 27 '15 at 17:58
  • 1
    Yeah. I think that function may have issues handling anything other than a plain directory. Also, if you are in a 32 bit shell, c:\windows\system32\virtmgmt.msc will not be present. – Matt Wrock Feb 27 '15 at 18:16
  • For a 32-bit shell you can use c:\windows\sysnative to bypass the folder redirection. – ferventcoder Feb 28 '15 at 12:42
  • @ferventcoder Thanks Rob; this is a 64 bit Win environment. Any thoughts on how to pin any sort of MMC to the taskbar? – p.campbell Mar 01 '15 at 17:45

0 Answers0