Show/hide desktop icons with Powershell only work once

Copper Contributor

my goal is to toggle the desktop icons on/off with one click (powershell script @ tasklist). i wrote the script below. it works the first time that i ran it (switch off). while the second run the reg key has changed, but after the explorer refreshed the reg key was set back to old value. with right-click and refresh desktop, everything works fine. i dont know what happens here and i've not found any help.

3 Replies
Hi,
this part of the community is only about discussion Microsoft Tech community site itself, Not product support.

you can find dedicated spaces about each product from the Community Hub, which you can see at the top of Every page in this website.

this is for Windows 10:
https://techcommunity.microsoft.com/t5/windows-10/ct-p/Windows10
@Pesche57 This is not the right place. You can post this in the Powershell community.
sorry, thanks for the hint!