Unifying Windows 10 Terminal Settings Again

Published October 21, 2017
Advertisement

UPDATE:
To fix the shortcuts disappearing form the start menu, I recommend removing and recreating the default shortcuts to Command Prompt and Windows PowerShell in your start menu before changing the permissions.  There is now a publicly available gist at:  https://gist.github.com/fastcall22/8f046b0e8e58284404427c413329a41c

 

Oh boy, it’s that time of year again where all of my terminal settings get reset!  Thanks, Windows 10 Fall Creators Update!

terminal-before.png.25dde56b4106a27529699bf2880dc529.png

 

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!

terminal-after.png.84f1fa24d11036602930716baa7ee1ac.png

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!

:^)

 
1 likes 2 comments

Comments

fastcall22

And once again, I’ve discovered more undefined behavior with Windows Search.  The permissions fix will remove the shortcut from appearing from the start menu.  Working on a fix.

October 24, 2017 03:43 PM
fastcall22

The issue appears to be within the default shortcuts themselves; the shortcuts to Windows Command Prompt, and Windows PowerShell copied from the default user’s start menu.  Removing these and replacing them with hand created shortcuts, setting “Start in” to `%HOMEDRIVE%%HOMEPATH%`, and proceeding with the permissions adjustments above will fix the shortcuts disappearing form the start menu.

January 28, 2018 05:12 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement