Novell Home

Preventing ZENworks from overriding a RegKey Value

Novell Cool Solutions: Trench
By Thorsten Mick

Digg This - Slashdot This

Posted: 30 Jan 2004
 

Sometimes a snapshot must add a value to an existing RegKey (like the path-variable). But ZENworks overrides the existing key with the new value. Here is my solution to patch this.

Requirement: MS Scripting-Host must be enabled on the Clients.

Go to ConsoleOne and open a Snapshot. Change to Distribution-Script and type in the Example in the Pre or Post Distribution-Script field. Change value_add from the Example to the value you want to add.

Script-Engine = %*WINSYSDIR%\WSCRIPT.EXE
Extension = .vbs

Example

'#################################################'#
'# Expand Path-Variable
'#
'#

value_add = "any value you want to add to an existing"
key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\path"

Set wshshell = CreateObject("WScript.Shell")
value_new = wshshell.RegRead (key)

if right(value_new, 1) <> ";" then
	value_new = value_new & ";"
end if
value_new = value_new & value_add
wshshell.RegWrite key, value_new, "REG_EXPAND_SZ"

If you have any questions you may contact Thorsten at thorsten.mick@keb.de


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell