Ark2FA Authentication Timeout and Session Duration Configuration

To enable users to log in and out without being prompted for MFA (Multi-Factor Authentication) again for a specified duration during Ark2FA authentication, please follow the steps below.

This configuration prevents repeated MFA prompts during login and logout for the duration (in minutes) assigned to the $NewLifetimeMinutes variable.

Prerequisites and Requirements

  • Server: This operation must be performed on the Primary AD FS Server.

  • Privileges: The PowerShell console must be executed as Administrator (Run as Administrator).

Configuration Script

Copy and paste the code below into the PowerShell window. To change the duration, you can update the $NewLifetimeMinutes = 480 (480 minutes = 8 hours) value at the beginning of the code.

# ============================================================
# ADFS General Timing Configuration Script
# ============================================================

# --- TIME TO SET (MINUTES) ---
# Change the value below according to your needs.
# Example: 1 Hour = 60, 8 Hours = 480, 12 Hours = 720
$NewLifetimeMinutes = 480 

try {
    Write-Host "Starting ADFS Lifetime Configuration..."
    Write-Host "Target Duration: $NewLifetimeMinutes Minutes"

    # 1. Applying Settings
    Set-AdfsProperties -SsoLifetime $NewLifetimeMinutes -ErrorAction Stop
    Set-AdfsProperties -PersistentSsoLifetimeMins $NewLifetimeMinutes -ErrorAction Stop
    Write-Host "New durations defined in the system."

    # 2. Restarting Service
    Write-Host "Restarting service (adfssrv)..."
    Restart-Service adfssrv -Force -ErrorAction Stop

    # 3. Verification
    Write-Host "--- Current Values ---"
    Get-AdfsProperties | Select-Object SsoLifetime, PersistentSsoLifetimeMins | Format-Table -AutoSize
}
catch {
    Write-Error "ERROR: Operation failed. $_"
}

Last updated