Hi,
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,
Alar