Darien Posted April 18, 2018 Share Posted April 18, 2018 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 More sharing options...
benched42 Posted April 18, 2018 Share Posted April 18, 2018 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 More sharing options...
Darien Posted April 18, 2018 Author Share Posted April 18, 2018 I discovered: you need to disable security policy "User Account Control: Admin Approval Mode for the Built-in Administrator account", which is enabled by the update. Link to comment Share on other sites More sharing options...
AdamUL Posted April 18, 2018 Share Posted April 18, 2018 Just an FYI. You can set this setting with AutoIt by using the UAC UDF. #RequireAdmin #include <UAC.au3> If _UAC_GetFilterAdministratorToken() = $UAC_ENABLED Then _UAC_SetFilterAdministratorToken($UAC_DISABLED) Adam Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now