Removing DropBox icon from navigation pane

This topic contains 2 replies, has 2 voices, and was last updated by  Alar 3 months, 2 weeks ago.

  • Author
    Posts
  • #74111

    Alar
    Participant

    Hi,

    I wanted to remove DropBox icon with powershell.
    I found registry that has to be changed from here:
    https://www.dropboxforum.com/t5/Installation-and-desktop-app/How-does-one-remove-the-Dropbox-link-from-the-Navigation-Pane-om/td-p/93970

    First part of changing the registry value is like that( this works ):
    $registrypath = "HKLM:\SOFTWARE\Classes\CLSID\{E31EA727-12ED-4702-820C-4B6445F28E1A}"
    $Name = "System.IsPinnedToNamespaceTree"
    $value = 0

    Set-ItemProperty -Path $registrypath -Name $Name -Value $value -Force

    But second part (changing permissions) -fails
    $acl = Get-Acl $registrypath
    $person = [System.Security.Principal.NTAccount]"Administrators"
    $access = [System.Security.AccessControl.RegistryRights]"FullControl"
    $inheritance = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit,ObjectInherit"
    $propagation = [System.Security.AccessControl.PropagationFlags]"None"
    $type = [System.Security.AccessControl.AccessControlType]"Deny"
    $rule = New-Object System.Security.AccessControl.RegistryAccessRule($person,$access,$inheritance,$propagation,$type)
    $acl.AddAccessRule($rule) —— this is line 61 in my script !
    $acl |Set-Acl

    With an error:
    You cannot call a method on a null-valued expression.
    At line:61 char:1
    + $acl.AddAccessRule($rule)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Can anyone please help me ?

    Best Regards,
    Alar

  • #74128

    Evgeny Fedorov
    Participant

    Hi Alar,

    Please make sure $acl object is not null. Most likely, something goes wrong at this line:

    $acl = Get-Acl $registrypath

    It cannot get ACL or whatever, please check

    • #74215

      Alar
      Participant

      Hi, thank you for anwser. Don't know why, but after computer restart script works...

You must be logged in to reply to this topic.