Unable to edit the post above so here's a code update.

Code:

;Installs and configures SNMP.
;
;Tested on: Windows 2000 SP4 and Windows XP SP2 using KixTart 4.50Beta1
;
;Requires: PSEXE.EXE - Freeware from sysinternals.
; http://www.sysinternals.com/utilities/psexec.html
; SYSOCMGR.EXE - Located and should stay in %windir%\system32.
; SYSOC.INF - Located and should stay in %windir%\inf.
; ??.TXT - Components to (un)install.
; http://support.microsoft.com/default.aspx?scid=kb;en-us;222444
; I386 folder - Just copy it from OS/SP CD.
; XNET.EXE - Available in older KixTart releases (4.23 and older).
; http://www.kixtart.org
;
;Based on: http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=131498&an=&page=0&vc=1
;
;Example: kix32.exe snmp.kix $remotepc=pc1
;
;
;Check if pc to execute on is set at command line.
If $remotepc = ""
$remotepc = @WKSTA
EndIf
;
;Set variables.
$key1 = "HKLM\software\Microsoft\Windows NT\CurrentVersion"
$key2 = "HKLM\SYSTEM\ControlSet001\Services"
$key3 = "HKLM\SYSTEM\CurrentControlSet\Services"
$key4 = "HKLM\software\Microsoft\Windows\CurrentVersion"
$key5 = "HKLM\SYSTEM\CurrentControlSet\Control\ServiceCurrent"
$key6 = "HKLM\SYSTEM\ControlSet001\Control\ServiceCurrent"
$sourcepath = ReadValue("\\" + $remotepc + "\" + $key1,"SourcePath")
$sourcepath2 = ReadValue("\\" + $remotepc + "\" + $key4 + "\Setup","SourcePath")
$sourcepath3 = ReadValue("\\" + $remotepc + "\" + $key4 + "\Setup","ServicePackSourcePath")
$winver = ReadValue ("\\" + $remotepc + "\" + $key1,"Productname")
;
;Select OS.
Select
Case InStr ($winver, "XP")
;write temp source path.
$rc = WriteValue("\\" + $remotepc +
"\" + $key1,"SourcePath","\\server\share\winxp\I386","Reg_SZ")
$rc = WriteValue("\\" + $remotepc +
"\" + $key4 + "\Setup","SourcePath","\\server\share\winxp\","Reg_SZ")
$rc = WriteValue("\\" + $remotepc + "\" + $key4 +
"\Setup","ServicePackSourcePath","\\server\share\winxp\SP2\","Reg_SZ")
;install snmp
Shell "\\server\share\PSEXEC.EXE \\" + $remotepc +
" -s -i sysocmgr.exe /i:%windir%\inf\sysoc.inf /u:\\server\share\snmp.txt /q"
ConfigSNMP()
Case InStr ($winver, "2000")
;write temp source path.
$rc = WriteValue("\\" + $remotepc +
"\" + $key1,"SourcePath","\\server\share\win2k\I386","Reg_SZ")
$rc = WriteValue("\\" + $remotepc +
"\" + $key4 + "\Setup","SourcePath","\\server\share\win2k\","Reg_SZ")
$rc = WriteValue("\\" + $remotepc + "\" + $key4 +
"\Setup","ServicePackSourcePath","\\server\share\win2k\SP4\","Reg_SZ")
;install snmp.
Shell "\\server\share\PSEXEC.EXE \\" + $remotepc +
" -s -i sysocmgr.exe /i:%windir%\inf\sysoc.inf /u:\\server\share\snmp.txt /q"
ConfigSNMP()
EndSelect
;
Function ConfigSNMP()
;write snmp settings to registry.
$rc = WriteValue ("\\" + $remotepc + "\" + $key2 +
"\kmixer\Enum", "0", "SW\{b7eafdc0-a680-11d0-96d8-00aa0051e51d}\{9B365890-165F-11D0-A195-0020AFD156E4}", "REG_SZ")
$rc = WriteValue ("\\" + $remotepc + "\" + $key2 +
"\SNMP\Parameters\TrapConfiguration\public", "1", "192.168.1.16", "REG_SZ")
$rc = WriteValue ("\\" + $remotepc + "\" + $key2 +
"\kmixer\Enum", "Count", "1", "REG_DWORD")
$rc = WriteValue ("\\" + $remotepc + "\" + $key2 +
"\kmixer\Enum", "NextInstance", "1", "REG_DWORD")
$rc = WriteValue ("\\" + $remotepc + "\" + $key2 +
"\SNMP\Parameters\RFC1156Agent", "sysContact", "SNMP Contact", "REG_SZ")
$rc = WriteValue ("\\" + $remotepc + "\" + $key2 +
"\SNMP\Parameters\RFC1156Agent", "sysLocation", "Ssytem location", "REG_SZ")
$rc = WriteValue ("\\" + $remotepc + "\" + $key2 +
"\SNMP\Parameters\ValidCommunities", "public", "8", "REG_DWORD")
$rc = WriteValue ("\\" + $remotepc + "\" + $key3 +
"\kmixer\Enum", "0", "SW\{b7eafdc0-a680-11d0-96d8-00aa0051e51d}\{9B365890-165F-11D0-A195-0020AFD156E4}", "REG_SZ")
$rc = WriteValue ("\\" + $remotepc + "\" + $key3 +
"\SNMP\Parameters\TrapConfiguration\public", "1", "192.168.1.16", "REG_SZ")
$rc = WriteValue ("\\" + $remotepc + "\" + $key3 +
"\kmixer\Enum", "Count", "1", "REG_DWORD")
$rc = WriteValue ("\\" + $remotepc + "\" + $key3 + "\kmixer\Enum", "NextInstance", "1", "REG_DWORD")
$rc = WriteValue ("\\" + $remotepc + "\" + $key3 +
"\SNMP\Parameters\RFC1156Agent", "sysContact", "SNMP contact", "REG_SZ")
$rc = WriteValue ("\\" + $remotepc + "\" + $key3 +
"\SNMP\Parameters\RFC1156Agent", "sysLocation", "System location", "REG_SZ")
$rc = WriteValue ("\\" + $remotepc + "\" + $key3 +
"\SNMP\Parameters\ValidCommunities", "public", "8", "REG_DWORD")
$rc = WriteValue ("\\" + $remotepc + "\" +
$key6, "", "76", "REG_DWORD")
$rc = WriteValue ("\\" + $remotepc + "\" + $key2 +
"\SNMPTrap", "ObjectName", "LocalSystem", "REG_SZ")
$rc = WriteValue ("\\" + $remotepc + "\" +
$key5, "", "76", "REG_DWORD")
$rc = WriteValue ("\\" + $remotepc + "\" + $key3 +
"\SNMPTrap", "ObjectName", "LocalSystem", "REG_SZ")
;set install path to original settings.
$rc = WriteValue("\\" + $remotepc +
"\" + $key1,"SourcePath",$SourcePath,"Reg_SZ")
$rc = WriteValue("\\" + $remotepc +
"\" + $key4 + "\Setup","SourcePath",$SourcePath2,"Reg_SZ")
$rc = WriteValue("\\" + $remotepc + "\" + $key4 +
"\Setup","ServicePackSourcePath",$SourcePath3,"Reg_SZ")
;stop and start snmp to be sure new settings are used.
Shell "\\server\share\Xnet.exe stop \\" + $remotepc + "\SNMP"
Sleep 10
Shell "\\server\share\Xnet.exe start \\" + $remotepc + "\SNMP"
Sleep 10
EndFunction

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.