Deploy User Agent via Script
Install, configure, update and uninstall the Kabeen user agent by script on Windows, Linux and macOS, with any deployment tool
Any tool that can run a script with administrator rights (SCCM/MECM, remote maintenance or fleet management tool, Salt, Intune for Linux custom scripts, first-boot script…) can deploy the agent. This article gives the installation, update and uninstallation scripts for Windows, Linux and macOS. If you use Intune, GPO, Jamf, Ansible or Puppet, follow the article for that tool instead.
The scripts read the API key, the structure and the team from the KABEEN_API_KEY, KABEEN_STRUCTURE and KABEEN_TEAM environment variables (see Where to find the values).
Do not leave the API key in clear text in your scripts: have your deployment tool provide it, from a secrets vault (Key Vault, CyberArk, Ansible Vault…).
Windows
Run in Windows PowerShell 5.1, elevated or in the SYSTEM context. How the MSI works and its options are described in User Agent on Windows.
Install and configure the agent
$msi = "\\server\share\Kabeen_1.6.1_x64_en-US.msi" # MSI downloaded from Kabeen
$p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList `
"/i `"$msi`" /qn /norestart /l*v `"$env:windir\Temp\kabeen-install.log`""
if ($p.ExitCode -notin 0, 3010) { exit $p.ExitCode } # 3010: success, restart requested
$key = "HKLM:\SOFTWARE\Policies\Kabeen\Configuration"
New-Item -Path $key -Force | Out-Null
New-ItemProperty -Path $key -Name ApiKey -PropertyType String -Value $env:KABEEN_API_KEY -Force | Out-Null
New-ItemProperty -Path $key -Name Structure -PropertyType String -Value $env:KABEEN_STRUCTURE -Force | Out-Null
New-ItemProperty -Path $key -Name Team -PropertyType String -Value $env:KABEEN_TEAM -Force | Out-NullThe configuration under HKLM applies to all users of the workstation. The optional keys are described in User Agent Configuration. The MSI automatically installs the browser extension, except for its "without extension" variant.
The agent starts at each user's next session logon, or within 5 minutes through the Kabeen Agent scheduled task.
Update the agent
Run the same msiexec /i command with the new MSI: it installs over the old one. The registry configuration is kept: there is no need to deploy it again.
Uninstall the agent
$pkg = Get-Package -Name Kabeen -ProviderName msi -ErrorAction SilentlyContinue
if ($pkg) {
$p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList "/x $($pkg.FastPackageReference) /qn /norestart"
if ($p.ExitCode -notin 0, 3010) { exit $p.ExitCode }
}
Remove-Item "HKLM:\SOFTWARE\Policies\Kabeen" -Recurse -Force -ErrorAction SilentlyContinueLinux
Beta version. The user agent for Linux is in beta. Its installation packages cannot yet be downloaded from the platform: request them from Kabeen support (support@kabeen.io), specifying your distributions and architectures.
Run as root. The package, its configuration and the specifics of each desktop environment are described in User Agent on Linux (beta).
Install and configure the agent
#!/bin/sh
# Usage: install-kabeen.sh /absolute/path/kabeen-<version>-linux-<arch>.deb (or .rpm)
set -eu
install -d -o root -g root -m 0755 /etc/kabeen
tmp=$(mktemp /etc/kabeen/.configuration.XXXXXX)
printf '{"ApiKey": "%s", "StructureId": "%s", "TeamId": "%s"}\n' \
"$KABEEN_API_KEY" "$KABEEN_STRUCTURE" "$KABEEN_TEAM" > "$tmp"
chown root:root "$tmp"
chmod 0644 "$tmp"
mv -f "$tmp" /etc/kabeen/configuration.json
case "$1" in
*.deb) DEBIAN_FRONTEND=noninteractive apt-get install -y "$1" ;;
*.rpm) dnf install -y "$1" ;;
*) echo "Unrecognized package: $1" >&2; exit 1 ;;
esacThe package automatically installs the browser extension; to deploy no browser policy at all, create /etc/kabeen/no-browser-policies before installation (see Browser extension). To deploy only the configuration, on a workstation where the package is already installed, run only the first part of the script.
Update the agent
Run the same script with the new package. Running agents restart on the new version by themselves within about one minute.
Uninstall the agent
#!/bin/sh
set -eu
if dpkg -s kabeen >/dev/null 2>&1; then
DEBIAN_FRONTEND=noninteractive apt-get purge -y kabeen
elif rpm -q kabeen >/dev/null 2>&1; then
dnf remove -y kabeen
fi
rm -rf /etc/kabeenEach user's data stays in place: deleting it is described in Uninstall the agent.
macOS
On macOS, a script can install and uninstall the agent, but not configure it: managed configuration goes through a configuration profile from your MDM, for the io.kabeen.agent domain (see User Agent Configuration). Without a profile, each user authenticates the agent from its icon. Run as root:
installer -pkg /path/Kabeen.pkg -target / # installation and updateUpdating works the same way, over the old version. The uninstallation script is the one in Deploy User Agent via Jamf, which works with any tool that runs a script as root.