Jump to content

Deleting a registry file on login


Recommended Posts

Guest spider6986
Posted

Hi everyone,

 

At the moment we have a problem with the students rotating the screens using hot keys even though hotkeys are disabled.

 

I have managed t find the registry file for this and found deleting that works.

 

The only problem is with so many machines, and so little time to get in the rooms its a very long winded process to delete it from every machine.

 

I am trying to figure out what line of code I can put in the logon script to delete it when it starts up, but so far am having no luck.

 

Can anyone help me????

 

The path to the registry file is HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CurrentVersion\RUN\HotKeysCmds

Posted

If you're using batch files for login scripts, the REG DELETE command is what you're after...

 

REG DELETE KeyName [/v ValueName | /ve | /va] [/f]

 

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

ValueName The value name, under the selected Key, to delete

When omitted, all subkeys and values under the Key are deleted

/ve delete the value of empty value name

/va delete all values under this key

/f Forces the deletion without propmt

 

Examples:

 

REG DELETE HKLM\Software\MyCo\MyApp\Timeout

Deletes the registry key Timeout and its all subkeys and values

 

REG DELETE \\ZODIAC\HKLM\Software\MyCo /v MTU

Deletes the registry value MTU under MyCo on ZODIAC

 

I always get confused as to whether a login script runs under user rights or machine rights though, so wouldn't expect it to delete a HKLM key successfully? You could always run this in a batch file from your admin machine with the machine names to be fixed listed - it supports remote key deletion.

Posted

This is quite simple to do:

 

Export a copy of the Run folder from the registry, then open it up in notepad. Using this example, I created a string value called "Test".

 

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"TEST"=-

 

After the equals sign, delete anything after it and insert a minus sign. Save the file and place it within your NETLOGON share.

 

Within your script, enter this line:

 

regedit /s \\SERVERNAME\NETLOGON\REG_FILE.REG

 

On a test machine, create a secondary backup of the Run folder, then try manually running the reg file. If it works, then place the above line of code in logon or startup scripts.

  • Thanks 1
Posted

I did the same thing a couple of weeks ago using the method Michael outlined. I also disabled the tray icon.

 

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]

"IgfxTray"=-

  • Thanks 1

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



×
×
  • Create New...