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.
Functions in Customlib
Section titled “Functions in Customlib”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().
Where Customlib is stored
Section titled “Where Customlib is stored”| 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”- The management servers of the point receive
customlib.cistogether with the rest of the point’sResourcesfolder. - When the CapaInstaller Replicator Service rebuilds the resource files on a management server, it packs the
Resources\CapaInstaller Client\Filesfolder intoResources\ClientFiles.zip. A promote to the point triggers this rebuild. - On every agent run, the agent downloads
ClientFiles.zipand copies each new or changed file to itsClient\Libfolder. A localcustomlib.cisthat 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
Section titled “Change Customlib”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.
- Open
Resources\CapaInstaller Client\Files\customlib.cison the share of the development Configuration Management Point. To open the share, right-click the point and select Open folder in Windows Explorer. - Make your changes. Increase the build number in the line
msCustomBuild = "...", so you can see in the package logs which version a device used. - Run a package on a test device, and check that its package log shows the new build number on the
CustomInitline. - 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.
Troubleshoot Customlib
Section titled “Troubleshoot Customlib”- Which Customlib did a device use? Every package log contains a
CustomInitline withVersion:andBuild:. Compare the build withmsCustomBuildin the server copy. - A device still has the old Customlib. Check that the agent has run since the change, and look for
customlib.cisin the agent log (CapaInstaller BaseAgent.login the client’sLogsfolder). 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.