Session Recording

Sessions are not recording

If application sessions are not recording successfully, check the application event log in the Event Viewer on the Session Recording Agent and Session Recording Server. Doing so can provide valuable diagnostic information.

If sessions are not recording, the possible cause might be:

  • Component connectivity and certificates. If the Session Recording components cannot communicate with each other, session recording can fail. To troubleshoot recording issues, verify that all components are configured correctly to point to the correct machines and that all certificates are valid and correctly installed.
  • Non-Active Directory domain environments. Session Recording is designed to run in a Microsoft Active Directory domain environment. If you are not running in an Active Directory environment, you might experience recording issues. Ensure that all Session Recording components are running on machines that are members of an Active Directory domain.
  • Session sharing conflicts with the active policy. Session Recording matches the active policy with the first published application that a user opens. Subsequent applications opened during the same session continue to follow the policy that is in force for the first application. To prevent session sharing from conflicting with the active policy, publish the conflicting applications on separate VDAs for multi-session OS.
  • Recording is not enabled. By default, installing the Session Recording Agent on a multi-session OS VDA enables recording for the VDA. Recording does not occur until an active recording policy is configured to allow it.
  • The active recording policy does not permit recording. A session can be recorded only when the session meets the rules of the active recording policy.
  • Session Recording services are not running. For sessions to be recorded, the Session Recording Agent service must be running on a VDA for multi-session OS and the Session Recording Storage Manager service must be running on the machine hosting the Session Recording Server.
  • MSMQ is not configured. If MSMQ is not correctly configured on the server running the Session Recording Agent and the machine hosting the Session Recording Server, recording problems might occur.
  • The Session Recording Database component is not upgraded properly. When you upgrade an existing installation, you must follow the upgrade sequence strictly. If you have more than one Session Recording Server in your deployment, you must first upgrade the Session Recording Server where the Session Recording Database component is installed. If not, the session recording fails. To correct the issue of the Session Recording Database component not being upgraded properly, perform either of the following actions:

    • Locate the Session Recording Server where the Session Recording Database component is installed. Then run the Citrix Virtual Apps and Desktops ISO or the SessionRecordingAdministrationx64.msi package on it.

    • Run the following script on any of the Session Recording Servers in your deployment. When running the script, provide the path to the SessionRecordingAdministrationx64.msi package as a parameter.

       param(
           [Parameter(Mandatory=$true)]
           [ValidateNotNullOrEmpty()]
           [string]$Installer
       )
       Add-Type -AssemblyName System.Data
      
       if (!(Test-Path "$PSScriptRoot\bin\lessmsi.exe")) {
           Write-Error "Download zip of binaries from https://github.com/activescott/lessmsi/releases/download/v1.10.0/lessmsi-v1.10.0.zip and extract to \bin in this folder!"
           exit
       }
      
       # Open MSI database
       $msi = New-Object -ComObject WindowsInstaller.Installer
       $msidb = $msi.OpenDatabase($Installer, 0)
      
       # Query File table
       $query = "SELECT Version FROM File WHERE FileName = 'SMAUDD~1.DLL|SsRecDatabase.dll'"
      
       $view = $msidb.OpenView($query)
       $view.Execute()
      
       # Get DLL version
       $record = $view.Fetch()
      
       $version = $record.GetType().InvokeMember("StringData", "GetProperty", $null, $record, 1)
       $parts = $version.Split(".")
       [int] $major = $parts[0]
       [int] $minor = $parts[1]
       $majorMinor = $parts[0..1] -join "."
       $versionCompare = $major * 100 + $minor
      
       # Get db instance and name
       $registryKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWARE\\Citrix\\SmartAuditor\\Server")
       $dbName = $registryKey.GetValue("DatabaseName")
       $dbInstance = $registryKey.GetValue("SmAudDatabaseInstance")
      
      
       write-host "Upgrade db($dbInstance\$dbName) to version $version"
      
       $schemaVersionMap = @{}
       $schemaVersionMap["19.12"] = "1.2.3.0"
       $schemaVersionMap["22.3"] = "1.3.3.0"
       $schemaVersionMap["22.6"] = "1.3.4.0"
       $schemaVersionMap["22.9"] = "1.3.4.0"
       $schemaVersionMap["22.12"] = "1.3.5.0"
       $schemaVersionMap["23.3"] = "1.3.6.0"
       $schemaVersionMap["23.5"] = "1.3.7.0"
       $schemaVersionMap["23.8"] = "1.3.8.0"
      
       $DBSchemaUpdatePatchList = @(
           "1.1.0.0",
           "1.2.0.0",
           "1.2.1.0",
           "1.2.2.0",
           "1.2.3.0",
           "1.2.4.0",
           "1.2.5.0",
           "1.2.6.0",
           "1.2.7.0",
           "1.2.8.0",
           "1.2.9.0",
           "1.3.0.0",
           "1.3.1.0",
           "1.3.2.0",
           "1.3.3.0",
           "1.3.4.0",
           "1.3.5.0",
           "1.3.6.0",
           "1.3.7.0",
           "1.3.8.0"
       )
      
       $currentSchemaVersion = $schemaVersionMap[$majorMinor]
      
       # Connect db
       $conn = New-Object System.Data.SqlClient.SqlConnection
       $conn.ConnectionString = "workstation id=.;packet size=4096;integrated security=SSPI;data source=$dbInstance;persist security info=True;initial catalog=$dbName"
      
       # Open connection
       $conn.Open()
      
       # Get existing db schema version
       $cmdGetSchema = $conn.CreateCommand()
       $cmdGetSchema.CommandType = [System.Data.CommandType]::StoredProcedure
       $cmdGetSchema.CommandText = "[GetSchemaVersion]"
       $out1 = $cmdGetSchema.Parameters.Add("@Major", [System.Data.SqlDbType]::Int)
       $out1.Direction = [System.Data.ParameterDirection]::Output
       $out2 = $cmdGetSchema.Parameters.Add("@Minor", [System.Data.SqlDbType]::Int)
       $out2.Direction = [System.Data.ParameterDirection]::Output
       $out3 = $cmdGetSchema.Parameters.Add("@Build", [System.Data.SqlDbType]::Int)
       $out3.Direction = [System.Data.ParameterDirection]::Output
       $out4 = $cmdGetSchema.Parameters.Add("@Revision", [System.Data.SqlDbType]::Int)
       $out4.Direction = [System.Data.ParameterDirection]::Output
       $cmdGetSchema.ExecuteNonQuery()
      
       $existDbSchemaVersion = [string]::Format("{0}.{1}.{2}.{3}", $out1.Value, $out2.Value, $out3.Value, $out4.Value)
       write-host "Existing DB Schema Version: $existDbSchemaVersion"
      
       if ([string]::Compare($existDbSchemaVersion, $currentSchemaVersion) -lt 0) {
           Write-Output "Upgrade $existDbSchemaVersion to $currentSchemaVersion"
      
           & $PSScriptRoot\bin\lessmsi.exe x $Installer $PSScriptRoot\ SsRecDatabase.dll
           $tempdir = "$PSScriptRoot\SOURCEDIR\Program Files\Citrix\SessionRecording\Database\Bin"
           # Load assembly and get resource
           $asm = [Reflection.Assembly]::LoadFile("$tempdir\SsRecDatabase.dll")
      
           foreach ($patch in $DBSchemaUpdatePatchList) {
               if ([string]::Compare($existDbSchemaVersion, $patch) -le 0 -and [string]::Compare($patch, $currentSchemaVersion) -lt 0) {
                   write-host "Applying $patch"
                   # switch to db
                   $switchCmd = $conn.CreateCommand()
                   $switchCmd.CommandText = "use [$dbName]"
                   $switchCmd.ExecuteNonQuery()
      
                   $resStream = $asm.GetManifestResourceStream("SmAudDatabase.$patch-MigrateDatabase.sql")
                   $bytes = New-Object byte[] $resStream.Length
                   $resStream.Read($bytes, 0, $resStream.Length)
                   $script = [System.Text.Encoding]::UTF8.GetString($bytes)
      
                   $statements = [regex]::Split($script, "\s[gG][oO]\s")
                   foreach($statement in $statements) {
                       $upgradeCmd = $conn.CreateCommand()
                       $upgradeCmd.CommandText = $statement
                       $upgradeCmd.ExecuteNonQuery()
                   }
      
                   $existDbSchemaVersion = $patch
               } else {
                   write-host "Skip $patch"
               }
           }
           # UpdateStaticData
           $staticCmd = $conn.CreateCommand()
           $staticCmd.CommandText = "use [$dbName];if not exists(select * from [dbo].[StartReason] where ID=4) begin insert [dbo].[StartReason] values(4, 'Event Triggered') end"
           $staticCmd.ExecuteNonQuery()
      
           if ($versionCompare -ge 2308) {
               # upgrade record policy version
               $staticCmd = $conn.CreateCommand()
               $staticCmd.CommandText = "update [dbo].[PolicyDocument] set PolicyFileFormatMajorVersion = 1, PolicyFileFormatMinorVersion = 3 where SystemDefined = 1"
               $staticCmd.ExecuteNonQuery()
      
               # upgrade endreason
               $staticCmd = $conn.CreateCommand()
               $staticCmd.CommandText = "if not exists(select * from [dbo].[EndReason] where ID=5) begin insert [dbo].[EndReason] values(5 , 'Dormant') end"
               $staticCmd.ExecuteNonQuery()
           }
      
           if ($versionCompare -ge 2311) {
      
               # upgrade endreason
               $staticCmd = $conn.CreateCommand()
               $staticCmd.CommandText = "if not exists(select * from [dbo].[EndReason] where ID=6) begin insert [dbo].[EndReason] values(6 , 'Deny') end"
               $staticCmd.ExecuteNonQuery()
           }
           write-host "Upgrade success!"
       }
       else {
           Write-Output "Current schema version don't need upgrade"
       }
      
       $conn.Close()
       <!--NeedCopy-->
      
Sessions are not recording

In this article