Some Swif workflows support placeholders inside command scripts. These placeholders are automatically replaced with secure values (such as the Swif admin username and password for the device) at runtime, so you do not need to hard-code credentials into your scripts.
This article describes the placeholders you can use, how they behave, and provides practical examples.
Available Placeholders
Placeholder | Description | Example Usage | Supported Platforms |
| Swif admin username for the device |
| macOS, Windows, Linux |
| Swif admin password for the device |
| macOS, Windows, Linux |
Use these placeholders exactly as shown (including curly braces) anywhere in your command script where you would normally provide the corresponding value.
Notes and Tips
Exact spelling is required — Placeholders must be written exactly as shown, including capitalization and curly braces. Extra spaces, missing braces, or typos will prevent replacement (e.g.,
{{ SWIF_ADMIN_USER }}with spaces is not valid).Works across multi-line scripts — All occurrences of a placeholder are replaced throughout the entire script. You can use the same placeholder multiple times.
Replaced even inside comments and quotes — Placeholders are replaced anywhere they appear, including inside comments, single-quoted strings, and double-quoted strings.
Behavior when placeholders are not used — Your command executes as written. Malformed placeholder strings are treated as normal text and not replaced.
Security reminder — Use placeholders instead of hard-coding admin credentials. Avoid logging or echoing full commands with resolved credentials.
Examples
Example 1 — Create a Local User Account (macOS)
#!/bin/sh
sysadminctl -adminUser {{SWIF_ADMIN_USER}} -adminPassword '{{SWIF_ADMIN_PASSWORD}}' \
-addUser newemployee -fullName "New Employee" -password 'Welcome123!'
Example 2 — Enable FileVault with Admin Credentials (macOS)
#!/bin/sh
sudo fdesetup enable -user {{SWIF_ADMIN_USER}} -password '{{SWIF_ADMIN_PASSWORD}}'
Example 3 — Download and Install Custom Software (macOS / Linux)
#!/bin/sh
curl <URL> -o /tmp/installer.zip
unzip /tmp/installer.zip -d /Applications
sysadminctl -adminUser {{SWIF_ADMIN_USER}} -adminPassword '{{SWIF_ADMIN_PASSWORD}}' \
-resetPasswordFor targetuser -newPassword 'TempPass!'
Example 4 — Multi-Line Script with Multiple Placeholder Uses
#!/bin/sh
# Verify admin access first
echo "Running as admin: {{SWIF_ADMIN_USER}}"
# Remove an old user account
sysadminctl -adminUser {{SWIF_ADMIN_USER}} -adminPassword '{{SWIF_ADMIN_PASSWORD}}' \
-deleteUser oldemployee
# Create a replacement account
sysadminctl -adminUser {{SWIF_ADMIN_USER}} -adminPassword '{{SWIF_ADMIN_PASSWORD}}' \
-addUser replacement -fullName "Replacement User" -password 'Secure456!'
Notice that {{SWIF_ADMIN_USER}} and {{SWIF_ADMIN_PASSWORD}} appear multiple times — every occurrence is replaced at runtime.
Example 5 — Windows (PowerShell)
$adminUser = "{{SWIF_ADMIN_USER}}"
$adminPass = ConvertTo-SecureString "{{SWIF_ADMIN_PASSWORD}}" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($adminUser, $adminPass)
New-LocalUser -Name "newuser" -Password (ConvertTo-SecureString "Welcome1!" -AsPlainText -Force)Troubleshooting
Problem | What to Check |
Placeholder not replaced | Verify exact spelling, capitalization, and curly braces. No extra spaces inside the braces. |
Script fails with an authentication error | Confirm the device has a valid Swif admin account provisioned. |
Only some placeholders were replaced | Check for typos in the unreplaced placeholders. Each one is matched independently. |
