Removing DropBox icon from navigation pane

Tagged: , ,

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Alar Alar 3 weeks, 3 days ago.

  • Author
  • #74111
    Profile photo of Alar


    I wanted to remove DropBox icon with powershell.
    I found registry that has to be changed from here:

    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,

  • #74128
    Profile photo of Evgeny Fedorov
    Evgeny Fedorov

    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
      Profile photo of Alar

      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.