DAK1974
(Fresh Scripter)
2007-11-06 12:29 PM
VBS to KIX. Where am i going wrong?

Folks,

RE: Installing SMS packages using OSD. VB to KIX help.

I've found this great little VB script which installs an SMS package on demand. I had a shot at converting it to KIX but can't seem to make it work. Can anyone point out where I'm going wrong please? See below.

Cheers,
Dave


VB:

Public Const adOpenStatic = 3
Public Const adLockReadOnly = 1
Public Const adLockOptimistic = 3

'vars
Dim objWshShell, objOSD

'wscript
Set objWshShell = CreateObject("WScript.Shell")

' Set SMS SiteCode and MP
objwshShell.Run "osdenv.exe /Regserver", 0, true
Set objOSD = CreateObject("OSD.Environment")
objOSD("OSDMP") = "SMS1:80"
objOSD("OSDSITECODE") = "PS1"

'install
cmd = objWshShell.Run("OSDSWDExec ""PS100001:PER-SYSTEM UNATTENDED INSTALL 1"" MSIEXEC.EXE /I BRXTEMPLATESC14.MSI /QB!-", 1, true)


MY KIX ATTEMPT:

;vars
Dim $objWshShell, $objOSD

;wscript
$objWshShell = CreateObject("WScript.Shell")

;Set SMS SiteCode and MP
$result = $objwshShell.Run('osdenv.exe /Regserver', 0, true)
$objOSD = CreateObject("OSD.Environment")
$objOSD.OSDMP = "SMS1:80"
$objOSD.OSDSITECODE = "PS1"

;install
$result = $objWshShell.Run('OSDSWDExec.exe "PS100001:PER-SYSTEM UNATTENDED INSTALL 1" MSIEXEC.EXE /I BRXTEMPLATESC14.MSI /QB!-', 1, true)


Richard H.Administrator
(KiX Supporter)
2007-11-06 03:23 PM
Re: VBS to KIX. Where am i going wrong?

Something like this maybe:
 Code:
Shell 'osdenv.exe /Regserver'
If @ERROR "Failed to register OSDENV: ["+@ERROR+"] "+@SERROR+@CRLF Exit @ERROR EndIf
$objOSD = CreateObject("OSD.Environment")
If 9<>VarType($objOSD) "Cannot create OSD object: ["+@ERROR+"] "+@SERROR+@CRLF Exit @ERROR EndIf
$objOSD.OSDMP = "SMS1:80"
$objOSD.OSDSITECODE = "PS1"
Shell 'OSDSWDExec.exe "PS100001:PER-SYSTEM UNATTENDED INSTALL 1" MSIEXEC.EXE /I BRXTEMPLATESC14.MSI /QB!-'
If @ERROR "Failed to execute OSDSWDExec.exe: ["+@ERROR+"] "+@SERROR+@CRLF Exit @ERROR EndIf


DAK1974
(Fresh Scripter)
2007-11-06 05:13 PM
Re: VBS to KIX. Where am i going wrong?

Thanks, Richard. I'll try that now...

DAK1974
(Fresh Scripter)
2007-11-06 05:38 PM
Re: VBS to KIX. Where am i going wrong?

Hi,

OSDSWDEXEC.EXE returns a non-descript error. I think the problem might be around the OSD environment and OSDDMP/OSDSITECODE bits as I can get the VBS to call my cut-down KIX script at the end and that works. Hmmm. Does the translation from VBS to KIX look OK for those OSD environment bits? I'm not sure.

Dave


Richard H.Administrator
(KiX Supporter)
2007-11-07 11:20 AM
Re: VBS to KIX. Where am i going wrong?

 Originally Posted By: DAK1974
Hmmm. Does the translation from VBS to KIX look OK for those OSD environment bits? I'm not sure.


I'm afraid you've exhausted my VB knowledge - I know KiXtart has problems with some types of object references, and you may have just stumbled on one.

Can you set these values in the environment instead?


LonkeroAdministrator
(KiX Master Guru)
2007-11-14 12:06 AM
Re: VBS to KIX. Where am i going wrong?

doesn't look right...

I would say kixtart doesn't support what you are trying to do with the property-methods.


Arend_
(MM club member)
2007-11-14 09:47 AM
Re: VBS to KIX. Where am i going wrong?

My guess would be:
 Code:
$objOSD("OSDMP").Value = "SMS1:80"
$objOSD("OSDSITECODE").Value = "PS1"


LonkeroAdministrator
(KiX Master Guru)
2007-11-14 12:18 PM
Re: VBS to KIX. Where am i going wrong?

yes, but last time I checked kixtart didn't support that syntax.
might be different with 4.60 but with this was the case with older versions.


Arend_
(MM club member)
2007-11-14 12:27 PM
Re: VBS to KIX. Where am i going wrong?

Eh, kixtart does support that syntax, I use it for Excel alot.

LonkeroAdministrator
(KiX Master Guru)
2007-11-14 01:24 PM
Re: VBS to KIX. Where am i going wrong?

ok, might be my bad then.
I could blame the fact that I haven't been scripting that much for ages.