How do I hide a custom drive with a registry key?

264 Views Asked by At

I am working on a project which creates a custom drive and is accessible under "This PC". The request is to hide the drive on a per-user basis using registry keys if possible.

The client machines are Citrix based on Windows Server 2008R2 but are being upgraded to 2016 shortly.

I know the GUID for the app which can be found in

HKLM\SOFTWARE\Classes\CLSID\{GUID}

I don't see anything obvious there which can hide the icon. I've also created the GUID at:

HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideMyComputerIcons\{GUID}

Which seems to only half work. It will hide the icon on the right pane however the navigation pane on the left still shows it. Restarting the pc didn't help to hide it.

1

There are 1 best solutions below

1
On

Copy the "Attributes" value from "HKLM\SOFTWARE\Classes\CLSID{GUID}\ShellFolder", add the value of SFGAO_NONENUMERATED and set it as the "Attributes" value in "HKCU\SOFTWARE\Classes\CLSID{GUID}\ShellFolder".

(In Windows calculator, switch to programmer mode, enter the HKLM value, click OR(|) and enter 1048576 to calculate the final attributes value)

If you are the author of this shell extension then you know if this is how your folder attributes are set or if they are set in IShellFolder::GetAttributesOf in which case you might need some custom code to allow hiding.

You might also want to add SFGAO_HIDDEN if non-enumerated is not enough.