Skip to content

OSD_Initialize

VB Scripting Library > OSD Scripting Library > OSD functions (OSD)

Initializes the CapaInstaller OSD Scripting library.
This function has to be called before all other functions in the library. The initialization sets variables based on the WinPE environment, OSDGui.ini etc.

No arguments provided.

Boolean, TRUE if function completed successfully.

Call OSD_Initialize after Job_Start. The function writes the values it detects to the script log.

OSD_Initialize reads the values that the OSD client stores in the HKLM\SOFTWARE\CapaSystems\CapaInstaller\OSD registry key in WinPE, and reads OSDGui.ini. It also calls Sys_GetSerialNumber, OSD_IsLaptop, OSD_IsDesktop, OSD_IsServer, Net_GetAdapterInfo, Sys_GetMac and Log_RegisterWellKnownFiles.

The following global variables are set and can be used in the rest of the script:

VARIABLE DESCRIPTION
gsBootServer The server that OSD is running from (the BootServer registry value).
gsBootserverMac The MAC address of the boot server, if it can be resolved.
gsManagementPoint The management point for the boot server’s IP address from the CMSIntegration section in OSDGui.ini. If no entry matches, the Default entry is used.
gsNewComputerName The name the computer gets (the NewComputerName registry value).
gsImageName The name of the image being deployed.
gsImageOSType The OS type of the image, for example Windows11x64.
gsOsSystem A short name for the OS type, for example WIN10, WIN11, 2019, 2022 or 2025. Not Found if the OS type is unknown.
gsModelName The hardware model name.
gsSerialNumber The serial number from BIOS.
gbIsLaptop TRUE if the chassis type is a laptop.
gbIsDesktop TRUE if the chassis type is a desktop.
gbIsServer TRUE if the chassis type is a server.
gsGatewayIP The IP address of the default gateway.
gsGatewayMac The MAC address of the default gateway, if it can be resolved.
gsDeployToDrive The drive the image is deployed to.
gsUnattendFile The full path to the answer file (unattend.xml or sysprep.inf) of the deployed image.
gsLogServerFolder The root folder that Log_SubmitLogs copies log files to. Default is the Logs folder on the OSD server share.

For a description of the registry values, see Create a new script.

Private Function IncludeScript(sScriptFile)
'...
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()
'... your script content ...
Job_End(bStatus)
'End main

Scripting Guidelines Constants Package Property Variables