Skip to content

Customlib

Customlib (customlib.cis) is a VBScript file that every CapaInstaller VBScript package loads before the Scripting Library. It holds the functions your packages call at fixed points in the script, so you can add your own organization-wide logic in one place instead of in every package.

Every package that Package Creator generates starts like this:

If bStatus Then bStatus=IncludeScript("customlib.cis")
If bStatus Then bStatus=IncludeLibrary("capalib.cin")
...
If bStatus Then bStatus=CustomInit("Package name")

For the rest of the package skeleton, see Getting Started with VB Scripting.

The default Customlib contains these functions:

Function When it runs What it does
IncludeLibrary(sLibrary) At the start of every package, from IncludeLibrary("capalib.cin") Loads the CapaInstaller Scripting Library from the client’s Lib folder. Don’t change this function: if it fails, no package can run.
CustomInit(sProductid) From the main section of every package, after Job_Start Writes the Customlib version and build to the package log, and calculates gsPackageRoot — the folder the package’s files are read from. sProductid is the package name.
CustomInstallationCompleted(sProductid) From Job_InstallationCompleted, at the end of every package Empty by default. Add code here that must run after every package. Its return value is ignored.

You can add your own functions to Customlib and call them from any package, for example from CustomPreInstall() or CustomPostInstall().

Location Path
Server (master copy) Resources\CapaInstaller Client\Files\customlib.cis on the share of each Configuration Management Point
Client Client\Lib\customlib.cis in the CapaInstaller folder, by default C:\Program Files\CapaInstaller\Client\Lib\customlib.cis

Each Configuration Management Point has its own copy, so all devices on the same point run the same Customlib. To make Customlib behave differently for some devices or departments, add conditions to your code, for example on gsBusinessUnitName or gsWorkstationName (see Variables).

How Customlib gets from the server to the clients

Section titled “How Customlib gets from the server to the clients”
  1. The management servers of the point receive customlib.cis together with the rest of the point’s Resources folder.
  2. When the CapaInstaller Replicator Service rebuilds the resource files on a management server, it packs the Resources\CapaInstaller Client\Files folder into Resources\ClientFiles.zip. A promote to the point triggers this rebuild.
  3. On every agent run, the agent downloads ClientFiles.zip and copies each new or changed file to its Client\Lib folder. A local customlib.cis that differs from the server copy is overwritten.

New devices get Customlib from the agent installer. If customlib.cis is in the same folder as the installer, the installer uses that file instead of the default. See CapaInstallerAgentSetup.exe.

Change Customlib on your development point first, and promote it to the next point when it works. This way a mistake in Customlib only affects your test devices.

  1. Open Resources\CapaInstaller Client\Files\customlib.cis on the share of the development Configuration Management Point. To open the share, right-click the point and select Open folder in Windows Explorer.
  2. Make your changes. Increase the build number in the line msCustomBuild = "...", so you can see in the package logs which version a device used.
  3. Run a package on a test device, and check that its package log shows the new build number on the CustomInit line.
  4. Promote the file to the child point: right-click the development point, select Promote, and under Point files select Custom library. See Promote in Configuration Management.

The devices on the child point receive the new Customlib on their next agent run.

When you upgrade CapaInstaller with the setup wizard, an existing customlib.cis on the points isn’t overwritten, so your changes are kept.

  • Which Customlib did a device use? Every package log contains a CustomInit line with Version: and Build:. Compare the build with msCustomBuild in the server copy.
  • A device still has the old Customlib. Check that the agent has run since the change, and look for customlib.cis in the agent log (CapaInstaller BaseAgent.log in the client’s Logs folder). See CapaInstaller log files.
  • All packages fail right at the start after a change. Every package loads Customlib, so an error in it can stop every package. Undo the change on the point, and let the agents pick up the corrected file.

OS Deployment scripts don’t use this file. They have their own custom library, OSDCustomLib. See Create a new script.