can someone help me combine these two .reg into a context menu flyout?

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 684
    Windows 10 x64 Pro
    Thread Starter
       #11

    Not sure if you overlooked, or just havent gotten to it - but as per my post up top, im not only trying to resolve those two commands not working (and it sounds like youre half way there) but im trying to change the hierarchy of the context menu entry.

    Ownership > Take Ownership
    > Restore Ownership > Restore Ownership SYSTEM
    > Restore Ownership TrustedInstaller

    I have one (or two) too many context menu entries flying about to serve the same purpose and im left with a whole lotta lua shields.

    if nothing else, the more elaborate examples such as this i have to learn from, the less ill have to harass you going forward
      My Computer

  2. Brink's Avatar
    Posts : 56,393
    64-bit Windows 10 Pro for Workstations build 21359
       #12

    Well, I know it's something simple, but I can't get past the invalid parameter error for TrustedInstaller yet.

    It should work under the RunAs key, but having the trouble above under its own instead.
      My Computers


  3. Posts : 684
    Windows 10 x64 Pro
    Thread Starter
       #13

    Brink said:
    Well, I know it's something simple, but I can't get past the invalid parameter error for TrustedInstaller yet.

    It should work under the RunAs key, but having the trouble above under its own instead.
    im sure its not something as simple as the formatting around NT Service\TrustedInstaller as far as quotations and backslashes go? I know some of that stuff requires double backslashes for the registry to pick up and spaces obviously require quotations etc. Still working on understanding the specifics.

    as far as the runas key goes, id prefer not to - but as a fallback if all 3 commands can be smooshed into one under that banner, it'd be better than the alternative (being none) lol.

    Dont spend too much time, but i know i certainly cant figure it out >.<
      My Computer

  4. Matthew Wai's Avatar
    Posts : 5,112
    Windows 10 Home 20H2
       #14

    Brink said:
    Well, I know it's something simple, but I can't get past the invalid parameter error for TrustedInstaller yet.
    The error can be fixed by the following:
    Code:
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"\"NT Service\\TrustedInstaller\"\" /t /c /l & pause' -Verb runAs\""
    Use double-quotation marks in \"\"NT Service\\TrustedInstaller\"\".
      My Computer


  5. Posts : 684
    Windows 10 x64 Pro
    Thread Starter
       #15

    Matthew Wai said:
    The error can be fixed by the following:
    Code:
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"\"NT Service\\TrustedInstaller\"\" /t /c /l & pause' -Verb runAs\""
    Use double-quotation marks in \"\"NT Service\\TrustedInstaller\"\".
    Inching forward, more minds set to the task :P

    Unfortunately, doesnt seem to work

    window flickers and closes.
      My Computer

  6. Matthew Wai's Avatar
    Posts : 5,112
    Windows 10 Home 20H2
       #16

    klepp0906 said:
    Unfortunately, doesnt seem to work
    The following works at my end.
    Code:
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"\"\"NT Service\\TrustedInstaller\"\"\" /t /c /l & pause' -Verb runAs\""
    Use six double quotation marks in \"\"\"NT Service\\TrustedInstaller\"\"\"
    The output is shown below:

    can someone help me combine these two .reg into a context menu flyout?-okay.jpg

    can someone help me combine these two .reg into a context menu flyout?-okay2.jpg
      My Computer


  7. Posts : 684
    Windows 10 x64 Pro
    Thread Starter
       #17

    Matthew Wai said:
    The following works at my end.
    Code:
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"\"\"NT Service\\TrustedInstaller\"\"\" /t /c /l & pause' -Verb runAs\""
    Use six double quotation marks in \"\"\"NT Service\\TrustedInstaller\"\"\"
    The output is shown below:

    can someone help me combine these two .reg into a context menu flyout?-okay.jpg

    can someone help me combine these two .reg into a context menu flyout?-okay2.jpg
    That was the ticket :)

    Dare i say the easy part is now over lol. Now to try to shoehorn the 3 into 1 context menu entry. Gotta figure out how to deal with that pesky owner rights group that gets created when taking ownership too.

    Figuring out the formatting for paths/commands in reg files needs to be high on my list. I understand quotes/paths, and evidently the backslashes have to do with the first one not being recognized due to it being a special character used by the registry so a 2nd one confirms it as an actual backslash.

    as far as the slashing of quotes, or double, or triple slashing. Sigh, I shoulda went into IT instead of my chosen careen path :P

    Thanks for your help!
      My Computer

  8. Matthew Wai's Avatar
    Posts : 5,112
    Windows 10 Home 20H2
       #18

    You are most welcome!
      My Computer


  9. Posts : 684
    Windows 10 x64 Pro
    Thread Starter
       #19

    Well, the mea culpa. some days/time later. the finished result

    Code:
    Windows Registry Editor Version 5.00
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership]
    "HasLUAShield"=""
    "MUIVerb"="Ownership"
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    "SubCommands"=""
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership\Shell]
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership\Shell\flyout01]
    "HasLUAShield"=""
    "MUIVerb"="Take Ownership"
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership\Shell\flyout01\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" && icacls \\\"%1\\\" /grant *S-1-3-4:F /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"= "powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" && icacls \\\"%1\\\" /grant *S-1-3-4:F /t /c /l & pause' -Verb runAs\""
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership\Shell\flyout02]
    "CommandFlags"=dword:00000020
    "HasLUAShield"=""
    "MUIVerb"="Restore to Administrators"
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership\Shell\flyout02\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"Administrators\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"Administrators\" /t /c /l & pause' -Verb runAs\""
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership\Shell\flyout03]
    "HasLUAShield"=""
    "MUIVerb"="Restore to System"
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership\Shell\flyout03\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership\Shell\flyout04]
    "HasLUAShield"=""
    "MUIVerb"="Restore to TrustedInstaller"
    
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\Ownership\Shell\flyout04\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"\"\"NT Service\\TrustedInstaller\"\"\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"\"\"NT Service\\TrustedInstaller\"\"\" /t /c /l & pause' -Verb runAs\""
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership]
    "HasLUAShield"=""
    "MUIVerb"="Ownership"
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    "SubCommands"=""
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership\Shell]
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership\Shell\flyout01]
    "HasLUAShield"=""
    "MUIVerb"="Take Ownership"
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership\Shell\flyout01\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" && icacls \\\"%1\\\" /grant *S-1-3-4:F /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"= "powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" && icacls \\\"%1\\\" /grant *S-1-3-4:F /t /c /l & pause' -Verb runAs\""
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership\Shell\flyout02]
    "CommandFlags"=dword:00000020
    "HasLUAShield"=""
    "MUIVerb"="Restore to Administrators"
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership\Shell\flyout02\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"Administrators\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"Administrators\" /t /c /l & pause' -Verb runAs\""
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership\Shell\flyout03]
    "HasLUAShield"=""
    "MUIVerb"="Restore to System"
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership\Shell\flyout03\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership\Shell\flyout04]
    "HasLUAShield"=""
    "MUIVerb"="Restore to TrustedInstaller"
    
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\Ownership\Shell\flyout04\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"\"\"NT Service\\TrustedInstaller\"\"\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"\"\"NT Service\\TrustedInstaller\"\"\" /t /c /l & pause' -Verb runAs\""
    I think it should be pretty complete as far as what youd ever need to restore to. I'm vague on permissions still (like most things lol) But if youre the pc owner I dont see a users group ever being assigned to anything by default, or needing assigning. I think administrator vs administrators is redundant etc.

    I decided against a second flyout for the restore items. KISS (keep it simple stupid) etc etc.

    can someone help me combine these two .reg into a context menu flyout?-image.png

    Thanks for the help gentlemen!
      My Computer

  10. Brink's Avatar
    Posts : 56,393
    64-bit Windows 10 Pro for Workstations build 21359
       #20

    Matthew Wai said:
    The error can be fixed by the following:
    Code:
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"\"NT Service\\TrustedInstaller\"\" /t /c /l & pause' -Verb runAs\""
    Use double-quotation marks in \"\"NT Service\\TrustedInstaller\"\".
    Thank you Matthew. I knew it had to be something simple.
      My Computers


 
Page 2 of 3 FirstFirst 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 05:37.
Find Us




Windows 10 Forums