Registry.Write
Top  Previous  Next


Adds or edits registry value

Please make sure to backup the registry before doing any changes.

Category
Registry

Script section
All

Registry.Write ValueType, HKEY, Key, ValueName, ValueData

ValueType
Type of value to write  
 
Options: DWORD | SZ | EXPAND_SZ | MULTI_SZ | BINARY  
·DWORD - 32-bit number (number between –2147483647 and 2147483648)  
·SZ - Text string  
·EXPAND_SZ - Text string that contains unexpanded references to environment variable, use "§" to get "%"  
·MULTI_SZ - Array of text strings, "§" after each entry  
·BINARY - Binary data, hex string  

HKEY

Options: HKEY_LOCAL_MACHINE | HKEY_USERS | HKEY_CURRENT_USER  
Notice: HKEY_CURRENT_USER requires Remote admin service  

Key
Key to write to  

Value
Name of value to add or edit  

ValueData
Value to write  

Other parameters
This command is executed on the current machine in the [Machines] section.  

Tip
Use the ExpEnvStrings function to expand environment variables.

Examples

SZ - set IE start page for current user
Registry.Write SZ, HKEY_CURRENT_USER,Software\Microsoft\Internet Explorer\Main, Start Page, www.altavista.com

SZ - clear a string value by leaving value data blank
Registry.Write SZ, hkey_local_machine, software\Microsoft\Windows NT\CurrentVersion\Winlogon, LegalNoticeCaption,

DWORD - Set number of days prior to password expiration date that warning dialog is displayed to 7
Registry.Write DWORD, hkey_local_machine, software\Microsoft\Windows NT\CurrentVersion\Winlogon, PasswordExpiryWarning, 7

Expand_SZ - write "%systemroot%"
Registry.Write EXPAND_SZ, hkey_local_machine, software\Microsoft\Windows NT\CurrentVersion\Winlogon, ExpandTest, §systemroot§

Multi_SZ example - write "value1", "value2" and "value3"
Registry.Write MULTI_SZ, hkey_local_machine, software\Microsoft\Windows NT\CurrentVersion\Winlogon, MultiTest, value1§value2§value3§

Binary example - write feb7a0c2b3f506bb
Registry.Write BINARY, hkey_local_machine, software\Microsoft\Windows NT\CurrentVersion\Winlogon, BinaryTest, feb7a0c2b3f506bb

Full example
Edit the registry on many machines at once