Jump to content

Access denied when running command "runas" after updating Windows 10


Recommended Posts

Hello,

 

I have a program that performs the command below:

 

$pid = RunAs ( "administrator" , @ComputerName , "<administrator password>" , 0 , @ComSpec & " /c reg add ""HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run"" /t REG_SZ /v ""example"" /d ""C:\example.exe"" /f" , "" , @SW_HIDE , $STDERR_CHILD + $STDOUT_CHILD )

$resultado = ""
$erro           = ""

    While 1

        $resultado = $resultado & StdoutRead ( $pid )
        $erro          = $erro             & StderrRead ( $pid )

        If @error Then ExitLoop

    WEnd

MsgBox ( 0 , $resultado & "|" & $erro )

 

After a Windows upgrade (probably the 1709), the "reg add" command has resulted in the "Access denied" message.

What could correct this?

 

Link to comment
Share on other sites

Not sure your syntax for the "reg" command is correct. From the help file for "reg add" found by typing "reg add /?" into a command prompt window, the REG command is lookinf for HKLM, HKCU, HKCR, HKU or HKCC. The full name of the root key is not acceptable.

REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f]
        [/reg:32 | /reg:64]

  KeyName  [\\Machine\]FullKey
           Machine  Name of remote machine - omitting defaults to the
                    current machine. Only HKLM and HKU are available on remote
                    machines.
           FullKey  ROOTKEY\SubKey
           ROOTKEY  [ HKLM | HKCU | HKCR | HKU | HKCC ]
           SubKey   The full name of a registry key under the selected ROOTKEY.

Who lied and told you life would EVER be fair?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...