Closed tumpio closed 9 years ago
Did you run the script on an clean installation + all updates, or has the system been used in the meantime? It won't help much if I just end up with "well I cannot reproduce this in my clean VM".
Well, it was installed yesterday night, so pretty clean :) The default language is not English. The take-own fails also on other script where it is used e.g fix-privacy-settings.
I'll try to find the cause, I think it might be some locale problem with names e.g. "Administrators"
So the reason is takeown-registry fails:
PS C:\Windows\system32> Takeown-Registry("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Spynet")
Exception calling "SetOwner" with "1" argument(s): "Joidenkin tai kaikkien tunnisteviittauksien muuntaminen epäonnistui."
At E:\Devel\Debloat-Windows-10\lib\take-own.psm1:22 char:5
+ $acl.SetOwner($owner)
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : IdentityNotMappedException
Exception calling "SetAccessRule" with "1" argument(s): "Joidenkin tai kaikkien tunnisteviittauksien muuntaminen epäonnistui."
At E:\Devel\Debloat-Windows-10\lib\take-own.psm1:28 char:5
+ $acl.SetAccessRule($rule)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : IdentityNotMappedException
Yes this can indeed be caused by having the system set to a different language. The other strings like "FullControl"
and so on should still work, but "Administrators"
should be changed, will look into this today. Thanks.
Can you retry with the latest version? I now use the predefined SID for referencing the Administrators group (src: KM243330). This should be the same among all languages.
Still fails, but there is also another "Administrators" in:
$rule = New-Object System.Security.AccessControl.RegistryAccessRule("Administrators", "FullControl", "Allow")
It works after replacing that too with $admins
This fails currently for me with permission denied error. And the script goes in infinite loop displaying the same error messages.
Gist of the error: https://gist.github.com/tumpio/0aa9198a07c4e187c288
Does it work for everyone else? @Carol666uk had similar problems here #36
Will this require some more "take-own" magic? :)