Oh boy, it’s that time of year again where all of my terminal settings get reset! Thanks, Windows 10 Fall Creators Update!
But this time, I’m prepared !!
I’ve made some adjustments to my previous attempt to Unify Windows 10 Terminal Settings. Namely, I’ve fixed the ACL not working as expected. Apparently `set-acl` attempts to reset the owner, which is denied when also removing the write permission. Additionally, the ACL needs to be reloaded in order to get the correct converted ACLs from the item’s parents. The workaround is as follows:
# deny current user write permissions
$item = get-item $path;
$acl = $item.GetAccessControl('access'); # https://stackoverflow.com/a/6646551
$acl.SetAccessRuleProtection($true, $true); # Disable inheritance, assume inherited
$item.SetAccessControl($acl);
$acl = $item.GetAccessControl('access'); # Reload ACL to obtain inherited permissions
$acl.RemoveAccessRuleAll($rule); # Remove existing rules for the user
$acl.AddAccessRule($rule);
$item.SetAccessControl($acl);
I’ve also added back in the registry fix:
$console = (get-item HKCU:\).OpenSubKey("Console", $true)
$console.GetSubKeyNames() |% {
if ( $pscmdlet.ShouldProcess($_, "Remove Subkey") ) {
$console.DeleteSubKey($_);
}
And after running:
remove-consoleprops -StartMenu -AdjustPermissions -Registry -ErrorAction Continue
… I was pleased to see that it worked as expected!
I will be working toward publishing these scripts as a GitHub gist, so these files are versioned and others can contribute.
That’s all for now. Thanks for reading; see you around!
:^)
↧