# $cs.Ini_WriteEntry

> Writes or updates a value in an INI file's section. If the INI file (or its parent folder) doesn't exist yet, it is created automatically.

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

### Description

Writes or updates a value in an INI file's section. If the INI file (or its parent folder) doesn't exist yet, it is created automatically.

### Syntax

$cs.Ini\_WriteEntry(string filepath, string section, string variable, string value)

### Parameters

#### filepath (String)

Path to the INI file. Created automatically, along with its parent folder, if it doesn't already exist.

#### section (String)

Section in the INI file to write to.

#### variable (String)

Variable under the section to create or update.

#### value (String)

Value to write.

### Return value

None

### Example

**PowerShell**

Disable an application's built-in update check after installation:

```powershell
$iniFile = "$env:ProgramData\Contoso\App\app.ini"
$cs.Ini_WriteEntry($iniFile, "updates", "checkForUpdates", "false")
```

Write a first-run marker for the PowerPack itself, in a config file that is created on demand:

```powershell
$stateFile = Join-Path $env:ProgramData "Contoso\App\state.ini"
$cs.Ini_WriteEntry($stateFile, "deployment", "firstRunCompleted", "true")
$cs.Job_WriteLog("First-run marker written to $stateFile")
```

Update a version string in a config file after a successful upgrade:

```powershell
$iniFile = Join-Path $env:ProgramData "Contoso\App\settings.ini"
$cs.Ini_WriteEntry($iniFile, "app", "installedVersion", $global:AppRelease)
$cs.Job_WriteLog("Recorded installed version $global:AppRelease in $iniFile")
```

### Related functions

[$cs.Ini_ReadEntry](/capainstaller/powerpacks/cs-ini-readentry/)
