0

i have made a simple VBScript file that enables Task Manager. but when i execute it , i get error "Invalid Root In Registry Key" why?

set Shell=CreateObject("Wscript.Shell")
shell.regwrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Microsoft\Windows\System\DisableTaskMgr","0","REG_DWORD"

1 Answers1

0

Add this to your code below WScript.Shell:

RunAsAdmin()
Function RunAsAdmin()
    If WScript.Arguments.length = 0 Then
        CreateObject("Shell.Application").ShellExecute "wscript.exe", """" & _
        WScript.ScriptFullName & """" & " RunAsAdministrator",,"runas", 1
        WScript.Quit
    End If
End Function

This will run the script as admin. If it does not work then check your registry path because it is probably incorrect.