
Precisamos excluir um valor de segurança da chave de registro da unidade de CD-ROM. O local principal é HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\IDE. A partir daí dependeria da marca e modelo da unidade de CD, mas deveria haver um valor de Segurança que deve ser excluído. Encontrei o seguinte código VBS, mas ele não parece estar funcionando ou fornece um código de erro:
'****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****
Após uma inspeção mais detalhada, o valor só pode ser excluído por SYSTEM. Preciso adicionar a permissão de administrador com permissões completas para excluir. Não tenho certeza se devo continuar usando VBS ou outro método para fazer isso em todos os PCs (cerca de 1.000).
Obrigado.