How to add a registry key using VBScript?
43,828
An example of registry entry creation would be:
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Script Center"
strValueName = "My DWORD Value"
dwValue = 13
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
where the targets can be changed accordingly to your needs.
Author by
powermun50
Updated on September 18, 2022Comments
-
powermun50 over 1 year
I want to add a registry key (DWORD=1) in
HKEY_LOCAL_MACHINE \SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
using VBScript. How can I do that? -
powermun50 about 11 yearsI am sorry. But i didn't understand. can you give me exact script for HKEY_LOCAL_MACHINE \SYSTEM\CurrentControlSet \Control\StorageDevicePolicies?
-
MDMoore313 about 11 years@powermun50 if you can't rewrite this script to suit your needs you probably shouldn't be editing the registry.
-
Karan about 11 years@MDMoore313: Very well said!