Estou lutando para fazer isso funcionar corretamente. Este .reg quando importado funciona na superfície, no entanto, após a execução, sou recebido com "Este ID de segurança não pode ser atribuído como o proprietário deste objeto"
Presumo que isso se deva ao fato de o cmd não ter sido iniciado como administrador. Alguém pode aconselhar sobre a alteração do comando? Acredito que, de encontros anteriores com requisitos semelhantes, você deve usar o powershell primeiro para abrir o cmd ou algo assim?
Aqui está o regfile
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership]
"HasLUAShield"=""
"MUIVerb"="Restore Ownership"
"NoWorkingDirectory"=""
"NeverDefault"=""
"SubCommands"=""
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell]
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM]
"HasLUAShield"=""
"MUIVerb"="Restore to System"
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM\command]
@="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
"IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller]
"HasLUAShield"=""
"MUIVerb"="Restore to TrustedInstaller"
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller\command]
@="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
"IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
[HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership]
"HasLUAShield"=""
"MUIVerb"="Restore Ownership"
"NoWorkingDirectory"=""
"NeverDefault"=""
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell]
[HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM]
"HasLUAShield"=""
"MUIVerb"="Restore to System"
[HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM\command]
@="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
"IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
[HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller]
"HasLUAShield"=""
"MUIVerb"="Restore to TrustedInstaller"
[HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller\command]
@="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
"IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
Bem, eu tenho o SYSTEM funcionando
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership]
"MUIVerb"="Restore Ownership"
"HasLUAShield"=""
"SubCommands"=""
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\shell\RestoreOwnershipSYSTEM]
@="Restore Ownership SYSTEM"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\shell\RestoreOwnershipSYSTEM\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\RestoreOwnership\shell\RestoreOwnershipTrustedInstaller]
@="Restore Ownership TrustedInstaller"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\shell\RestoreOwnershipTrustedInstaller\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\""
Infelizmente, o TrustedInstaller ainda cai de cara com
Invalid parameter "Service\TrustedInstaller"
Eu sei que tem que ser algo estúpido, simples, estou perdendo isso.....
Resposta final. Tudo girava em torno da formatação.