Wednesday, August 20, 2008

Scripting registry changes - technique

5 Types of technique in scripting registry change
A brief Description

1. INF
a. Also known as Setup Information files
b. With the .inf extension
c. Able to add, change, and delete registry values
d. difficulty level for INF is medium
e. It is easy to install, just right click on it and select install
f. example of INF file
[Version]
Signature=$CHICAGO$

[DefaultInstall]
AddReg=Add.Settings
DelReg=Del.Settings

[Add.Settings]
HKLM, Software\Microsoft\Windows\CurrentVersion\Run,,,"myprogram"

[Del.Settings]
HKCU, Software\Microsoft\Windows\CurrentVersion\Run

2. REG
a. has the .reg extension
b. it is the easiest way to add, modify, or delete registry
c. example
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"avgnt"="\"C:\\Program Files\\Avira\\AntiVir PersonalEdition Classic\\avgnt.exe\" /min"
"Acrobat Assistant 8.0"="\"C:\\Program Files\\Adobe\\Acrobat 8.0\\Acrobat\\Acrotray.exe\""
"Zone Labs Client"="C:\\Program Files\\Zone Labs\\ZoneAlarm\\zlclient.exe"
"chkpendrive"="c:\\chkpendrive\\chkpendrive.exe c:\\chkpendrive\\chk.txt"
"LanSpeed2"="C:\\Program Files\\LanSpeed2\\LanSpeed2.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\OptionalComponents]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\OptionalComponents\IMAIL]
"Installed"="1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\OptionalComponents\MAPI]
"Installed"="1"
"NoChange"="1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\OptionalComponents\MSFS]
"Installed"="1"

3. Batch
a. has the extension of .bat
b. Example
@echo off
Reg delete %HKCV%\Explorer\MenuOrder /f

4. Script
a. You can either use VBscript or JScript to change(Windows support both)
b. example (VBScript)
Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegWrite "HKCU\Software\testing\",1,"REG_BINARY"
c. Example (JScript) * Case sensitive
var WshShell = WScript.CreateObject("WScript.Shell");

WshShell.RegWrite("HKCU\\Software\\Testing\\",1,"REG_BINARY");

5. MSI
a. MSI stands for Windows Installer Packages.
b. This is just like normal installer such as Microsoft Office and so on.
c. Needs to be compile only can be used.
d. Needs more higher level scripting and programming skills

0 comments: