Cameyo allows you to execute scripts on your backend servers, at different moments of a session's lifetime.
This can be done by creating a Cameyo directory under ProgramData or the user's profile, and naming the script accordingly.
- Create file C:\ProgramData\Cameyo\StartupBefore.bat, with one line: "calc.exe".
- Result: this script will be executed every time a session starts.
- Connect to your Cameyo server as admin.
- Create on it a directory C:\ProgramData\Cameyo
- Within this directory, create a VBS or BAT file called StartupBefore.vbs or StartupBefore.bat.
- This script will then execute for any Cameyo session starting on this server.
Scripts can be placed in one of two locations: %UserProfile%\Cameyo or %ProgramData%\Cameyo.
The name portion of the script file determines its execution mode:
- StartupBefore: script will execute before the session's module. For example, if the session is intended to launch WordPad.exe, the script will launch before WordPad executes.
- StartupAfter: script will execute after the session's module, but right before opening the session (before hiding the "Connecting" HTML screen and showing the app session to user). For example, if the session is intended to launch WordPad.exe, the script will launch before WordPad executes.
- StartupEarly: script will execute before the session's module, and even before any session preparation (i.e. environment variables, storage virtualization) is made by Cameyo. This is recommended for special cases only.
- *Sync: an optional suffix which blocks the workflow until the script finishes execution. Example: StartupBeforeSync.bat -> session will wait for script to finish before starting the session's application.
- StartupSystem: script will execute as SYSTEM user, hence with maximum local privileges. This is only recommended for cases where script requires administrator privileges.
- C:\ProgramData\Cameyo\StartupBefore.vbs: executes before program starts.
- C:\ProgramData\Cameyo\StartupBeforeSync.vbs: executes before program starts, holds session start until script ends.
- C:\ProgramData\Cameyo\StartupAfter.vbs: executes after program has started, right before it is shown to user.
- C:\Users\RemoteUser1\Cameyo\StartupAfterSync.vbs: executes after program has started, right before it is shown to user. Holds session start until script ends.
Script injection using Power Tags
In addition to the above, you can define scripts using Cameyo's Power Tags, using this syntax:
In your inline script commands, use ^| to specify new line.
- !STARTUP_BEFORE_SYNC_BAT=@echo off^|echo %TIME% >> c:\test.log
- !STARTUP_BEFORE_PS1=Add-Content -Path .\DateTimeFile1.log, .\DateTimeFile2.log -Value (Get-Date) -PassThru
- !STARTUP_BEFORE_SYNC_VBS=MsgBox "Hello world. Your session will start as soon as you click OK.", vbSystemModal
Inline launcher substitution script
Cameyo also allows you to launch your program using a custom inline script by setting the config Power Tag "!LAUNCHER_[type]". In this case, Cameyo will not launch your program directly but rather through the inline script you've defined, passing to it the original program path as an argument, followed by the original arguments if any.
Async time stamping inline script:
!STARTUP_BEFORE_BAT=@echo off^|echo %TIME% >> %USERPROFILE%\test.log
Automated 5 minutes session termination:
!STARTUP_BEFORE_BAT=@echo off^|timeout 300^|C:\RemoteAppPilot\RemoteAppPilot.exe -EndSession
Custom launcher 1:
!LAUNCHER_BAT=@echo off^|echo Executing %1 in a few seconds...^|timeout 5^|%1
Custom launcher 2 (asynchronous):
!LAUNCHER_BAT=@echo off^|echo Hi %USER_ID%! Now launching your program %CAMEYO_APPNAME%^|start "" "%CAMEYO_CMD%" %CAMEYO_ARGS%^|pause