We need to delete a Security value from CD-ROM drive registry key. The main location is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\IDE. From there it would depend on the make and model of the CD Drive, but there should be a Security value that must be deleted. I found the following VBS code but it doesn’t seem to be working or give an error code:
'****SCRIPT START****
' this script searches for all "security"-keys under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\IDE\ and deletes them
Option Explicit
Const HKEY_LOCAL_MACHINE = &H80000002
Dim oReg : Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Dim oShell : Set oShell = CreateObject("WScript.Shell")
Dim sPath, aSub, sKey, aSubToo, sKeyToo, dwValue
' Get all keys within sPath
sPath = "SYSTEM\CurrentControlSet\Enum\IDE"
oReg.EnumKey HKEY_LOCAL_MACHINE, sPath, aSub
' Loop through each key
For Each sKey In aSub
'Get all subkeys within the key 'sKey'
oReg.EnumKey HKEY_LOCAL_MACHINE, sPath & "\" & sKey, aSubToo
For Each sKeyToo In aSubToo
oReg.deleteValue HKEY_LOCAL_MACHINE, sPath & "\" & sKey & "\" & sKeyToo , "Security"
if Err.Number<>0 then
MsgBox Err.Description ' FOR TESTING ONLY
Err.Clear
end if
Next
Next
'****SCRIPT END****
Upon closer inspection the value can only be deleted by SYSTEM. I need to add the administrator permission full permissions to delete. Not sure if I should continue using VBS or another method to get this done on all the PCs (about 1,000).
Thanks.