Search code examples
powershellrefreshremoting

Refresh/Restart Explorer via Remoting


I have some code that unpins and pins items from the task bar and start menu, which I run using Remoting, as a means of cleaning up lab machines between sessions. It works great, other than I need to log off and back on to see the changes. This is somewhat similar to another bit of code I have, which changes the icon of a shortcut in order to "badge" it as an updated file. That code also requires a refresh, but there I am able to use a technique I found here...This does a refresh of Explorer and the desktop shortcut shows up correctly. However, the same code does not do a refresh of the task bar it seems. I also found this, which also seems to not impact the Taskbar. Also, this is related to the Remoting, because when I run the same code "locally" no refresh is needed. So, curious if anyone knows a way to directly refresh the task bar (and Start Menu) via Remoting? Or am I going to need to brute force it and just log the user off?


Solution

  • Well, this is interesting, and proof that sometimes we look for complex solutions to simple problems. All the examples I found are pretty complex, but what works fine is simply this...

    Stop-Process -processName: Explorer
    

    No need even to restart, as Explorer restarts automatically and near instantly.