Page tree
Skip to end of metadata
Go to start of metadata

Scripting Guidelines for using CapaInstaller Scripting Library

The OSD library can be included in the following predefined OSD Scripts used by OSDGui during the WinPe (boot media) phase of the Operating Systems Deployment process.

  • PreGUIScript.wsf
  • PreDiskPartScript.wsf
  • PreImageScript.wsf
  • PreDriverCopyScript.wsf
  • PrePatchScript.wsf
  • PreBootScript.wsf

(warning) NOTE: The PostInstallScript.wsf is not supported. The reason for this is that the OSD Library is only available during the WinPE phase.

IncludeScript function

To include the CapaInstaller OSD Scripting Library, in the script, you must include the following code in the script:

Private Function IncludeScript(sScriptFile)
	Dim sCmd
	Dim sClientDir
	Dim sScriptDir
	'Begin
	bStatus=True
	On Error Resume Next
	Dim oLocalShell : Set oLocalShell=CreateObject("WScript.Shell")
	Dim oLocalFso : Set oLocalFso = CreateObject("Scripting.FileSystemObject")
	sScriptDir = Mid(WScript.ScriptFullName,1,Len(WScript.ScriptFullName)-Len(WScript.ScriptName)-1)
	sClientDir=oLocalShell.RegRead("HKLM\Software\CapaSystems\CapaInstaller\Client Directory")
	If bStatus and (sClientDir<>"") Then
		If oLocalFso.FileExists(sClientDir & "\Lib\" & sScriptFile) Then
			sCmd = oLocalFSO.OpenTextFile(sClientDir & "\Lib\" & sScriptFile,1).ReadAll
		ElseIf oLocalFso.FileExists(sScriptDir & "\" & sScriptFile) Then
			sCmd = oLocalFSO.OpenTextFile(sScriptDir & "\" & sScriptFile,1).ReadAll
		End If
	Else
		bStatus=False
  End If

	ExecuteGlobal sCmd
	IncludeScript=bStatus
End Function

'Begin
  bStatus=True
  If bStatus Then bStatus=IncludeScript("customlib.cis")
  If bStatus Then bStatus=IncludeLibrary("Capalib.cin")
  If bStatus Then bStatus=IncludeLibrary("Osdlib.cin")
  If bStatus Then bStatus=Job_Start("WS","Script Name","1.0","ScriptName.log","INSTALL")
  If bStatus Then bStatus=OSD_Initialize()

  'Place your own code here

  Job_End(bStatus)
'End main

Script Comments

The function IncludeScript includes the customer-specific CapaInstaller module CustomLib.cis.
The function IncludeLibrary includes the CapaInstaller Scripting library and the CapaInstaller OSD library (this function is located in the customlib.cis).
 
Before CapaInstaller functions can be used the CapaInstaller Scripting library must be initialized. This is done from the function call Job_Start. When a Job has finished the function Job_End must be called.
Before OSD specific functions can be used, the CapaInstaller OSD Scripting library must be initialized. This is done from the function call OSD_Initialize.

See Also

Job_Start, Job_End and OSD_Initialize function description for further details.

  • No labels