0

im fairly new to Powershell and im currently trying to use some functions I found on the internet. The Problem is that there's something I have to do so I can use it but I don't understand it.

So let's get to it.

I'm trying to use the functions of the following Website:

https://judge2020.com/powershell-unpin-edge-store-mail-and-pin-word-outlook-excel/index.html

The following part I don't understand:

If you are also looking to pin things, you need to copy over powershell.exe to a new file called explorer.exe and run the Below function.

This seems to be really necessary but I have no clue what I have to do there. Can someone please explain to me what exactly I have to do? Also i would really like to understand why.

Thanks in advance.

drmgames
  • 29
  • 4
  • 1
    Looks like Windows only makes the "Pin to Taskbar" verb visible when the calling process is called `explorer`. You need to make a copy of powershell.exe, ie. `Copy-Item $PSHOME\powershell.exe somewhere\else\explorer.exe`, then run the command from that copy of powershell – Mathias R. Jessen Jan 28 '20 at 11:50
  • 2
    I believe though the exploer trick was patched some time ago though (Windows 10). If it ends up not working... I made my own research in the past two weeks and came up with this alternative: https://stackoverflow.com/questions/59778951/pin-program-with-parameters-to-taskbar-using-ps-in-windows-10/59842634#59842634 – Sage Pourpre Jan 28 '20 at 12:08
  • @SagePourpre Hey, thank you very much for your help. I'm not sure if i actually get how to use it. Cause I made a test.ps1 file and pastet the Code of the "Function Definition" section into the Fille. Then I wrote a few Lines that looks as following: `New-PinnedItem -Path 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'` But that didn't really work, so my Question now is do i NEED to add Arguments? and if so, what Arguments do i have to pass to have a simple, standard chrome icon pinned? Or do i actually have to add the function as a module? – drmgames Jan 28 '20 at 15:04
  • 1
    @drmgames No arguments needed. If Chrome is closed and not already on the taskbar, it will be pinned. If Chrome is already pinned, the function will unpin it (it works as a toggle by default.) If Chrome is open but not pinned, calling the function will pin it on the taskbar where it is. In all case, you cannot pin a second instance of an item that is already pinned unless it has different arguments (or one instance with, one instance without.) – Sage Pourpre Jan 28 '20 at 16:19
  • 1
    tl;dr : Close all instances of Chrome before trying it again. If already pinned, it will unpin. If not pinned, it will add itself as a pinned item. (All of this assume Windows 10) – Sage Pourpre Jan 28 '20 at 16:22
  • @SagePourpre maybe im just doing it stupidly wrong but somehow it doesn't really work. I have made a script with the snippet and have added a line at the bottom wich should pinn chrome to the taskbar. I've run the script but nothing happened so i tried to restart the explorer.exe but even after that the chrome icon didn't show up on the taskbar. Do i have to restart my whole System? Or do I have to add any Library for Powershell or something like that? Does it still work for you? PS: I have the latest Win10 version. – drmgames Jan 29 '20 at 14:59

0 Answers0