ur

Unable to delete registry value

3 posts in this topic

I have a registry value in which the name is having \ and when I am trying to delete the registry,it is failing because of \.

The registry is given below.

 

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Active Setup\Installed Components\{2D46B6DC-2207-486B-B523-A557E6D54B47}]
"Version"="9,0,8112,16421"
"Locale"="*"
"C:\\ProgramData\\Symantec\\Symantec Endpoint Protection\\"="C:\\ProgramData\\Symantec\\Symantec Endpoint Protection\\"

Can you please suggest how to delete the last value.

Share this post


Link to post
Share on other sites



Hi.

Welcome to the forum!

Autoit does *NOT* "escape" the BACKSLASHES. So you will need to make the double BACKSLASHES single BACKSLASHES.

 

Please lookup in the help file:

RegRead()
RegWrite()
RegDelete()

 

and possibly ...

#RequireAdmin

... in case you also need to handle keys / values in HKLM

 

$key="HKEY_CURRENT_USER\Software\Microsoft\Active Setup\Installed Components\{2D46B6DC-2207-486B-B523-A557E6D54B47}"
$val="C:\ProgramData\Symantec\Symantec Endpoint Protection\"

$Current=RegRead($key,$val)
MsgBox(0,"Result","KeyName: " & $key & @CRLF & _
"ValueName: " & $val & @CRLF & _
"ValueContent: " & $Current & @CRLF & _
"ErrorCode: " & @error)

 

 

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
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

  • Similar Content

    • GreenSparks
      By GreenSparks
      Hi!
      I post here because i was wonderring if someone in this forum could help me with my script.
      What i'm trying to do, is to basically install a new keyboard layout in Windows and activate it. I want to acheive by the registry or the command line, but not with the autoit automation tools, i don't find it stable...
      Thanks for your help and have a good day!
    • Leo1906
      By Leo1906
      Hello guys,
      I'm having a problem right here ..
      I was trying to create a few Registry Values using autoit, but it seems to me that Autoit can't write those values to this specific part of the registry ..
      Here is the code I'm trying to run:
      RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\test\command", "", "REG_SZ", "C:\test\convert.exe %1 geojson|convert") I'm definitly sure that the path is correct. Script is runned with Admin Rights. Everything's fine here.
      It's possible to read other values stored by Windows in this directory:
      MsgBox(0, 0, RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Windows.burn", "Description")) But you can't edit those using Autoit. I don't know what this is. In my eyes it's an Autoit Bug or something like that ...
      Possible solution for me is to write a ".reg" file and run it afterwards, but this is an unclean method I don't really want to use ..
      Any suggestions on this?
       
      Edit: the OS is Windows 7 x64 German Language btw ..
    • Wicked_Caty
      By Wicked_Caty
      I wanted to have a few lines that copy the whole registry into a file. I know that there is RegRead, but I don't want to type every single key into my code...
      Any way of doing this easily? Filetype doesn't matter, as long as it isn't encrypted. A batch or exe would be okay, if it's in the same location on every PC. Doing this without admin permissions would be awesome too
      Thanks
    • ViciousXUSMC
      By ViciousXUSMC
      Another project idea that I am trying to get working.
      A USB GPS device needs to be assigned COMM Port 25 when it is plugged into the computer.  It obviously gets the first open port when plugged in the first time and if I manually change it to 25 it will get a new port again if somebody plugs the device into a new USB port.
      So I want to make a script that can detect the device, and move/configure its port automatically.
      I started off finding this UDF: https://www.autoitscript.com/forum/topic/128546-serial-port-com-port-udf/?page=32
      It was useful for finding the device is plugged in and what port its on, but it does not have the ability to actually change the port.
      I think that will have to be done via registry, or perhaps via Objects.
      I just want to double check my facts here and get a grip on what I need to do.
      Registry has the following keys that change:
      HKLM\HARDWARE\SERIALCOMM - \Device\ProlificSerial0
      This key just lists the COMM Port for the device, it changes based on its current port.
      HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_067B&PID_2303]
      Under this key is a subkey that will duplicate every time the device gets a new port, I have not figure out quite yet how to determin what that subkey will be named, but it has the "FriendlyName" key and also the Device parameters\PortName key
      Both of those are unfortunately SYSTEM level permission so that makes scripting a change even harder.
      Last is HKLM\SYSTEM\CurrentControlSet\Control\COM Name Arbiter
      This contains the record of what comm ports are occupied or vacant via binary to hex.  I would have to find a way to read its current value and change it to show port 25 taken and if possible free up the port taken by the device before the change.  Not sure how to write something like that.
      Has anybody done something like this before?  If so what was your best approach?
    • barrikid
      By barrikid
      I am trying to create anti-procrastination software, basically by utilizing the DisallowRun parameter in the Group Policy. I am adding registry values into the register to add the programs I want disallowed through the restricted.txt file (each line in the file is a program I want to disallow)
      So, this is what I have so far and it does work, but There was a time that it didn't, and the only reason is because of permissions.
      ;Anti-Procrastinator V0.1 ;Checks version of windows, if 32x or 64x Dim $registryKey If @OSType = "WIN32_NT" Then $registryKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" EndIf Dim $restrictionFile startup() Func startup() RegWrite($registryKey, "DisallowRun", "REG_DWORD", 1) $registryKey &= "\DisallowRun" addToReg() EndFunc ;Adds programs in Restricted.txt into the registry Func addToReg() $restrictionFile = FileOpen("Restricted.txt") Dim $str = FileReadLine($restrictionFile), $count = 1 While Not @error While $str <> "" RegWrite($registryKey, ""&$count, "REG_SZ", $str) $str = FileReadLine($restrictionFile) $count += 1 WEnd WEnd FileClose($restrictionFile) EndFunc ;... What I had to do, to get this working, is go into the registry and manually set the Explorer folders permissions to full access for my account. If I use #REQUIREADMIN it will work (assuming that access is given, but I don't want to ask for admin privileges, well, unless I can brute force a yes). I have also noticed in other posts, it doesn't mention you need to change permissions, something I had to piece together myself!
      So, what I want to know, is how to I get the permissions to be full control to me, without having to manually set them. Or be able to brute force admin rights (which I don't think is possible)