Home > database >  Have a batch file check the value of a registry key, echo if it is set how I want and change it if i
Have a batch file check the value of a registry key, echo if it is set how I want and change it if i

Time:09-28

I want to have a script that will check the following Registry Key for

HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity
Enabled Reg_DWORD 0x0

If the value is set to 0x0, I want the script to echo Hypervisor Enforced Code Integrity is Disabled

If the value is set to anything else, I want to script to echo a statement, and then edit the registry value.

This is what I have so far, my issue is that the for /f command keeps erroring out. Any help would be really appreciated.

Set regkey="HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity"
Set Value=Enabled

for /f "tokens=2* delims=    "
%%A IN (reg query %regkey% /v %Value%) DO SET base=%%B
if            
  • Related