# $cs.Reg_GetInteger

> Reads a numeric (DWORD/QWORD) registry value.

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

### Description

Reads a numeric (DWORD/QWORD) registry value. Returns a nullable long, so `$null` is returned if the value doesn't exist or can't be parsed as a number — always check for `$null` before using the result.

### Syntax

$cs.Reg_GetInteger(string registryroot, string regkey, string regvalue)

### Parameters

#### registryroot (String)

Root hive: `HKLM`/`HKEY_LOCAL_MACHINE`, `HKCU`/`HKEY_CURRENT_USER`, or `HKU`/`HKEY_USERS`.

#### regkey (String)

Registry key path containing the value, relative to `registryroot`.

#### regvalue (String)

Name of the value to retrieve. Pass `""` for the key's default value.

### Return value

Nullable long. `$null` if the value doesn't exist or isn't numeric.

### Example

**PowerShell**

```powershell
$enable64Bit = $cs.Reg_GetInteger('HKLM', 'SOFTWARE\Microsoft\.NETFramework', 'Enable64Bit')
if ($null -ne $enable64Bit -and $enable64Bit -eq 1)
{
    $cs.Job_WriteLog("64-bit JIT is enabled")
}
```

Reading a version-as-DWORD marker written by a previous install and comparing it against the version being installed now, guarding against `$null` when the marker was never set.

```powershell
$installedBuild = $cs.Reg_GetInteger('HKLM', 'SOFTWARE\Contoso\AppSuite', 'BuildNumber')
if ($null -eq $installedBuild)
{
    $cs.Job_WriteLog("No previous build recorded, treating as a fresh install")
}
elseif ($installedBuild -lt 4500)
{
    $cs.Job_WriteLog("Upgrading from build $installedBuild")
}
```

Reading a feature-flag DWORD to decide whether an optional install step should run.

```powershell
$reportingEnabled = $cs.Reg_GetInteger('HKLM', 'SOFTWARE\Contoso\AppSuite\Features\Reporting', 'Enabled')
if ($reportingEnabled -eq 1)
{
    $cs.Job_WriteLog("Reporting feature is enabled, installing reporting components")
}
```

### Related functions

[$cs.Reg_SetDword](/capainstaller/powerpacks/cs-reg-setdword/) [$cs.Reg_SetQword](/capainstaller/powerpacks/cs-reg-setqword/) [$cs.Reg_GetString](/capainstaller/powerpacks/cs-reg-getstring/)
