# Add-PSDll

> Loads the CapaOne.ScriptingLibrary .NET assembly from $DllPath and creates the $cs object that every $cs.* helper call in a PowerPack script goes through.

Source: https://docs.capaone.com/capainstaller/powerpacks/add-psdll/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Loads the `CapaOne.ScriptingLibrary` .NET assembly from `$DllPath` and creates the `$cs` object that every `$cs.*` helper call in a PowerPack script goes through.

:::note
This is part of the fixed `#### MAIN ####` scaffolding — `$cs = Add-PSDll` is called once, immediately after `PSlib.psm1` is imported, before any of your `PreInstall`/`Install`/`PostInstall` code runs. You don't call this yourself.
:::

### Syntax

Add-PSDll

### Parameters

None. Uses the script-scoped `$DllPath` variable (and `$global:RunType`, if set, to validate standalone-mode configuration).

### Return value

`[CapaOne.ScriptingLibrary]` — the `$cs` object used throughout the rest of the script.

### Example

**PowerShell**

```powershell
# From the MAIN section of the script template — shown for reference only:
Import-Module (Join-Path $global:Packageroot $pgkit 'PSlib.psm1') -ErrorAction stop
$cs = Add-PSDll
```

### Related functions

[Initialize-Variables](/capainstaller/powerpacks/initialize-variables/)
