Xibo-Player / Xibo-Client for Windows / MSI Parameters for automatic deployment

Hello,

We’re using OPSI as deployment system.
I want to create a package for OPSI for an automatic deployment.

The package is already finished and the automatic deployment works for now.

The problem is that I want to give the xibo server and server token while install, so the Player is able to connect automaticly after deployment. I don’t want to install more than 10 clients in different locations by hand.

I there any way to give this parameters to the msi-installation while installing?

I was unable to find any information about parameters for the msi-file.

Thanks for help.
Best wishes David.

Hi David,

If you’re referring to the ServerKey and ServerUri, then yes, absolutely!

I haven’t used OPSI specifically to create an MSI, I used InstallShield and Wix Toolset. In the end, they all provide a similar set of functionalities.

Since you’ve already set up the deployment, the final step is to create or modify the config XML via OPSI. You can use PowerShell, Bash, or the opsi-script for that.

There are two config files: One in the installation directory and another in %USERPROFILE%\AppData\Roaming (at least in my version, which is still R203).

===

Here’s a script I found on my drive that might serve as a rough reference. It’s not mine just something I got from another user in this community:

alterXiboConfigServer.ps1
# Modifies Xibo player defaults

# The XML entries requiring change:
# <ApplicationSettings>
#    <ServerKey>[your-server-key]</ServerKey>
#    <DisplayName>[Computer Name]</DisplayName>
#    <ServerUri>[Xibo Server]</ServerUri>
#    <SplashOverride>[Alternative splash image]</SplashOverride>
#I went about it another way. I image our systems and have the system run this powershell script prior to first 
#login but after the Xibo windows client is installed.
#Be aware, there is no error catching and it must be run before the client runs the first time. 
#When the client runs, it uses the defaults stored in C:\Program Files (x86)\Xibo Player\default.config.xml to create the config file.

#The script also creates and gives full control to local windows users of the xibo library folder.

#Hope this helps some of you.

#======================================

#    <LibraryPath>C:\XiboLibrary\</LibraryPath>
# </ApplicationSettings>

$xibodefaultconfigfile = "C:\Program Files (x86)\Xibo Player\default.config.xml"
$xibolibrarypath = "C:\XiboLibrary\"

# Check Xibo Library path exists
if (!(Test-Path($xibolibrarypath))) {
    # Create folder
    New-Item -ItemType Directory -Path $xibolibrarypath
}

# Set permissions for Xibo Library to allow local users full control

# Get the Access Control List (ACL) for the directory
$acl = Get-ACL -Path $xibolibrarypath

# Create a new rule to grant full control to the local Users group
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("Users", "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")

# Add the rule to the ACL
$acl.AddAccessRule($rule)

# Set the modified ACL back to the directory
$acl | Set-Acl -Path $xibolibrarypath

# Download Splash image
$ImageURL = '[Splash URL download]'
$ImageDestinationFolder = "C:\Windows\Web\Screen"
$image = Join-Path -Path $ImageDestinationFolder -ChildPath "Xibo-Splash.png"
Start-BitsTransfer -Source $ImageURL -Destination "$image"

# Edit XML
[xml]$xmlDoc = Get-Content $xibodefaultconfigfile

$xmlDoc.ApplicationSettings.ServerKey = "[your-server-key]"
$xmlDoc.ApplicationSettings.DisplayName = $env:COMPUTERNAME
$xmlDoc.ApplicationSettings.ServerUri = "http://[Xibo Server]/"
$xmlDoc.ApplicationSettings.SplashOverride = "$image"
$xmlDoc.ApplicationSettings.LibraryPath = "$xibolibrarypath"

$xmlDoc.save($xibodefaultconfigfile)

If you’d like me to clarify, just let me know! :slight_smile:

Dear Schweminska,

For now I’m able to alter the default Xibo Config file with this Powershell Script.
The Xibo-lib folder is created successfully, and the right-acl is also working (I had to replace “Users” with “Benutzer” on a german OS version). I can also see al changes in the default config.

I figured out, that I had to remove the XiboConfig.xml in the AppData folder inital for all users. If theese file exists, the xibo client ignores the DefautlConfig.xml file.

So finally I got a working deployment for xibo included config with Opsi.

Thanks for Your help…

setup.opsiscript:

; ----------------------------------------------------------------
; This is a opsi-script file.
; See https://opsi.org    https://uib.de
; This code was originally created by opsi-setup-detector 4.3.2.6
; ----------------------------------------------------------------
encoding=utf8

;here we start
[Actions]

;check if the running opsiscript version is not too old
requiredOpsiscriptVersion >= "4.12.5.0"

;fetch helper libraries
importlib "uib_exitcode.opsiscript"
importlib "osd-lib.opsiscript"


; All variables are defined here:
include_insert "declarations.opsiinc"
; All sections are defined here:
include_append "sections.opsiinc"

; ----------------------------------------------------------------
comment "put fixed infos into the script (maybe produced by the setup detector maybe manually)"
; ----------------------------------------------------------------
; the values can be manually edited or automatically suggested by the opsi setup detector
;
; ----------------------------------------------------------------
; $ProductId$ is the name of the product in opsi, only lower letters, no umlauts, no white spaces, use '-' as a separator
Set $ProductId$		= "xibo-client-v4-r403-1-win32-x86"
; the path where we find the product after the installation
Set $InstallDir$	= "unknown"
set $targetprogram$ = ""
Set $MinimumSpace$	 = "836 MB"
; ----------------------------------------------------------------
; the operating system, in which the interpreter is running
; supported values are  "Windows_NT", "Linux", "MacOS"
set $OS$ = GetOS

Message "Installing " + $ProductId$ + " ..."

; ----------------------------------------------------------------
comment  "check if the script is adequate to the environment"
; ----------------------------------------------------------------

if not(($OS$ = "Windows_NT"))
	logError "Installation aborted: wrong OS version: only Windows"
	isFatalError "wrong OS"
	; Stop process and set installation status to failed
endif

if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError "No Space"
	; Stop process and set installation status to failed
endif

; ---------------------------------------------------------------
comment "inform the user at the PC about product installation"
; ----------------------------------------------------------------
; for a better visual appearance, show some graphic (at most of size 160x160 [px] )
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$



set $installerSourceDir$ = "%scriptpath%\files1"

if FileExists("%ScriptPath%\delinc.opsiinc") 
	comment "Start uninstall part"
	include_insert "%ScriptPath%\delinc.opsiinc"
endif

Message "Installing " + $ProductId$ + " ..."


; ---------------------------------------------------------------
comment "run  the setup program"
; ----------------------------------------------------------------

; the call to the installer is more stable if we set the path
ChangeDirectory $installerSourceDir$
;----------------------------------------------
Winbatch_install_1 /sysnative
powershellCall('./alterXiboConfigServer.ps1')
powershellCall('Get-ChildItem -Path C:\Users -Recurse -Filter XiboClient.xml -File | Remove-Item -Force -Confirm:$false')

;----------------------------------------------
; ---------------------------------------------------------------
comment "check the result"
; ----------------------------------------------------------------
; check the outcome of the call, produce either a "failed" state of the script or log the result
set $ExitCode$ = getlastexitcode
if "true" = isMsiExitcodeFatal($exitcode$, "true", $ErrorString$ )
	includelog "%opsiLogDir%\"+$ProductId$+".install_log.txt" "50" "utf16le"
	
	LogError $ErrorString$
	isfatalerror $ErrorString$
else
	Comment $ErrorString$
endif
1 Like