|
|
|||||||
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) |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Thanks, Richard. I'll try that now... |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
doesn't look right... I would say kixtart doesn't support what you are trying to do with the property-methods. |
||||||||
|
|
|||||||
My guess would be: Code: $objOSD("OSDMP").Value = "SMS1:80" $objOSD("OSDSITECODE").Value = "PS1" |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
Eh, kixtart does support that syntax, I use it for Excel alot. |
||||||||
|
|
|||||||
ok, might be my bad then. I could blame the fact that I haven't been scripting that much for ages. |