Skip to content

Instantly share code, notes, and snippets.

@guychouk
Last active January 26, 2021 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guychouk/754187c193e14449d46d6134917d5aec to your computer and use it in GitHub Desktop.
Save guychouk/754187c193e14449d46d6134917d5aec to your computer and use it in GitHub Desktop.
A Powershell script to hide or show OneDrive in the explorer tree for Windows 10 (64-bit)
switch ($args[0]) {
"hide" {
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 0
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 0
break;
}
"show" {
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 1
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 1
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment