Jump to content

REGWRITE


Recommended Posts

REG_QWORD appears to be an illegal arguement in AutoIT.

In RegEdit REG_QWORD adds a Binary Number to a Registry Key.

With the exception of the code for REG_QWORD the following code works:

CODE
;Load Logoff Script

global $mls = -1

Global $file[12] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]

For $i = 0 To UBound($file) - 1

$mls = $mls + 1

_runLogoffScriptCHK($file[$i])

Next

Func _runLogonScriptCHK($filename)

$read1 = (regread("HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\GROUPPOLICY\STATE\MACHINE\SCRIPTS\SHUTDOWN\" & $filename & "\", "script"))

$read2 = (regread("HKLM\SOFTWARE\MICROSOFT\POLICIES\MICROSOFT\WINDOWS\SYSTEM\SCRIPTS\SHUTDOWN\" & $filename & "\", "script"))

If $read1 = "" and $read2 = "" Then

Writereg()

Exit

ElseIf $read1 = "mylogoff.exe" and $read2 = "mylogoff.exe" Then

Exit

Elseif $read1 <> "mylogoff.exe" and $read2 <> "mylogoff.exe" Then

return(0)

EndIf

EndFunc ;==>_runPROG

Func Writereg()

RegWrite ("HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\GROUPPOLICY\STATE\MACHINE\SCRIPTS\SHUTDOWN\"& $MLS & "\", "Script", "REG_SZ", "mylogoff.exe")

RegWrite ("HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\GROUPPOLICY\STATE\MACHINE\SCRIPTS\SHUTDOWN\" & $MLS & "\", "Parameters", "REG_SZ", "")

RegWrite ("HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\GROUPPOLICY\STATE\MACHINE\SCRIPTS\SHUTDOWN\"& $MLS & "\", "ExecTime", "REG_QWORD", "")

RegWrite("HKLM\SOFTWARE\MICROSOFT\POLICIES\MICROSOFT\WINDOWS\SYSTEM\SCRIPTS\SHUTDOWN\"& $MLS & "\", "Script", "REG_SZ", "mylogoff.exe")

RegWrite("HKLM\SOFTWARE\MICROSOFT\POLICIES\MICROSOFT\WINDOWS\SYSTEM\SCRIPTS\SHUTDOWN\"& $MLS & "\", "Parameters", "REG_SZ", "")

RegWrite("HKLM\SOFTWARE\MICROSOFT\POLICIES\MICROSOFT\WINDOWS\SYSTEM\SCRIPTS\SHUTDOWN\"& $MLS & "\", "ExecTime", "REG_QWORD", "")

EndFunc

Is there an easy solution?

In Regedit you can export and import including REG_QWORD iems. If this is the case can AutoIT copy the exported item into the Key and if so

what would that code look like or would that be achieved by building a robot using AutoIT3Recorder that actually runs the Regedit import process.

Assistance is always appreciated

Ant..

Link to comment
Share on other sites

AutoIt supports 4 RegWrite types.

You may need to use Reg.exe to export your entries and to import them back in when needed.

:shocked:

Exporting then deleting the item in gpedit.msc and then importing the keys back into to registery does not work. There must be another key/s

that are related to the task for it to work. I have reverted to a robot that will run the gpedit process.

Thanks for the comments

Ant..

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...