Page 1 of 1 1
Topic Options
#182291 - 2007-11-06 12:29 PM VBS to KIX. Where am i going wrong?
DAK1974 Offline
Fresh Scripter

Registered: 2003-07-28
Posts: 19
Loc: Scotland
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)

Top
#182296 - 2007-11-06 03:23 PM Re: VBS to KIX. Where am i going wrong? [Re: DAK1974]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
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

Top
#182302 - 2007-11-06 05:13 PM Re: VBS to KIX. Where am i going wrong? [Re: Richard H.]
DAK1974 Offline
Fresh Scripter

Registered: 2003-07-28
Posts: 19
Loc: Scotland
Thanks, Richard. I'll try that now...
Top
#182303 - 2007-11-06 05:38 PM Re: VBS to KIX. Where am i going wrong? [Re: DAK1974]
DAK1974 Offline
Fresh Scripter

Registered: 2003-07-28
Posts: 19
Loc: Scotland
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

Top
#182312 - 2007-11-07 11:20 AM Re: VBS to KIX. Where am i going wrong? [Re: DAK1974]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 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?

Top
#182596 - 2007-11-14 12:06 AM Re: VBS to KIX. Where am i going wrong? [Re: Richard H.]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
doesn't look right...

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

download KiXnet

Top
#182613 - 2007-11-14 09:47 AM Re: VBS to KIX. Where am i going wrong? [Re: Lonkero]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
My guess would be:
 Code:
$objOSD("OSDMP").Value = "SMS1:80"
$objOSD("OSDSITECODE").Value = "PS1"

Top
#182618 - 2007-11-14 12:18 PM Re: VBS to KIX. Where am i going wrong? [Re: Arend_]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#182619 - 2007-11-14 12:27 PM Re: VBS to KIX. Where am i going wrong? [Re: Lonkero]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
Eh, kixtart does support that syntax, I use it for Excel alot.
Top
#182620 - 2007-11-14 01:24 PM Re: VBS to KIX. Where am i going wrong? [Re: Arend_]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, might be my bad then.
I could blame the fact that I haven't been scripting that much for ages.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.06 seconds in which 0.022 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org