Virtualization, technology, and random rantings with a focus on Citrix and VMware.

SiteManager Please!

So you have have SiteManager and you want to virtualize this app into Citrix. You may have noticed there are some caveats with. One of the issues that we encountered (we’ve been running this for several years across several versions now), is that you have to be creative to separate users because of the reporting port that is needed.

When a user logs in, it creates a port based on the INI file. That works all fine and well until player two enters the arena. So….. We had to utilize a set of scripts to create this separation of user space and create the random port per user. We’ve tried these in powershell and VB script. There wasn’t any performance difference or ease of configuration from what we found. I’ve added the scripts below so that you can more easily onboard this app into XenApp.

This launching script you will point in Citrix Studio is the one below. It is a batch script .bat.

REM TransportLaunch
@echo off
start /wait C:\SMAPP\FileshareMapDrives.vbs
start /wait C:\SMAPP\SmappUpdateINI.vbs
start /B /D Y:\SMAPP318-CTXTST\ C:\SMAPP\smapp.exe

This one will run and call the other visual basic scripts that actually do the work.

The first work script is to map the drive we are going to store the smdb file and the smapp.ini file that will contain the random port number.

'FileshareMapDrives checks "fileshareserver" fileshare share for the user's app configuration directory. 
'If it is not there, it creates it and maps the "M" drive in the citrix session to it.

DIM fso, MyFile, strCurrentLine, strPortNum, strNewPortNum, strUserName, CitrixServer

'Determine which Citrix server you have attached to.
 Set WSHNetwork = CreateObject("WScript.Network")
' CitrixServer = WSHNetwork.ComputerName
 CitrixServer = "fileshareserver"

Set fso = CreateObject("Scripting.FileSystemObject")

' Retrieve logged in username
 strUserName = WSHNetwork.UserName

' Determine if the user's directory exists. If not create it

If fso.FolderExists("\\" & CitrixServer & "\fileshare\" & strUserName) THEN
Else
   fso.CreateFolder("\\" & CitrixServer & "\fileshare\" & strUserName)
End If

' Map new Drive for the INI file
  On Error Resume Next
WSHNetwork.MapNetworkDrive "M:", "\\" & CitrixServer & "\fileshare\" & strUserName 
  If Err.Number <> 0 Then
    On Error GoTo 0
    WSHNetwork.RemoveNetworkDrive "M:", True, True
    WSHNetwork.MapNetworkDrive "M:", "\\" & CitrixServer & "\fileshare\" & strUserName 
  End If
  On Error GoTo 0

'wscript.sleep(5000)
'wscript.echo "Maps are done"

 'SmappUpdateINI
DIM fso, MyFile, strCurrentLine, strPortNum, strNewPortNum, strUserName, CitrixServer

After the above script runs, it will have your location mapped to point the smapp.exe file to the smapp.ini file it will need to load. Next up, the smappupdate.ini script, which is also a visual basic script.

Set fso = CreateObject("Scripting.FileSystemObject")


If fso.FolderExists("M:\SMAPP318-CTXTST") THEN
' wscript.echo "M:\SMAPP318-CTXTST exists"
Else
   fso.CreateFolder("M:\SMAPP318-CTXTST")
' wscript.echo "M:\SMAPP318-CTXTST did not exist and I just created it"
End If


' Determine if the directory SMAPP318-CTXTST exists. If not create it


If fso.FileExists("M:\SMAPP318-CTXTST\SMDBL00.DB") Then
Else
    fso.CopyFile "\\sharelocation\SMAPP318-CTXTST\SMDB\SMDBL00.DB", "M:\SMAPP318-CTXTST\", True
End If

If fso.FileExists("M:\SMAPP318-CTXTST\SMAPP.INI") Then
Else
    ' Open the file.  Change the path to where you have your file saved.
    Set MyFile = fso.OpenTextFile("\\sharelocation\SMAPP318-CTXTST\SMDB\SMAPP.INI", 1, TRUE)

    ' Create a temp file to copy into.
    Set fs1 = fso.CreateTextFile ("\\sharelocation\SMAPP318-CTXTST\SMDB\Temp.txt",True)
    fs1.close
    Set MyFile2 = fso.OpenTextFile ("\\sharelocation\SMAPP318-CTXTST\SMDB\Temp.txt", 8)

    ' Copy each line into the temp file.
    Do Until MyFile.AtEndOfStream
        Line = MyFile.ReadLine
        ' Increment the port number by 1.
        If InStr(1,Line, "Status Monitor Port=",1) Then
            strPortNum = Right(Line, 5)
            PortNum = CLng(strPortNum)
            PortNum = PortNum + 1
            strNewPortNum = Cstr(PortNum)
            MyFile2.WriteLine("Status Monitor Port=" & strNewPortNum)
        else
            MyFile2.writeline line
        End If
    Loop



    Set MyFile = nothing
    Set MyFile2 = nothing

    ' Copy the temp file over original file and create a backup copy (UserName.bak).
    fso.CopyFile "\\sharelocation\SMAPP318-CTXTST\SMDB\Temp.txt", "\\sharelocation\SMAPP318-CTXTST\SMDB\SMAPP.INI", true
    fso.CopyFile "\\sharelocation\SMAPP318-CTXTST\SMDB\Temp.txt", "\\sharelocation\SMAPP318-CTXTST\SMDB\" & strUserName & ".BAK", True
    fso.CopyFile "\\sharelocation\SMAPP318-CTXTST\SMDB\Temp.txt", "M:\SMAPP318-CTXTST\SMAPP.INI", true
'    MyFile2.Close
'    Set MytFile2 = nothing
    fso.DeleteFile "\\sharelocation\SMAPP318-CTXTST\SMDB\Temp.txt"
End If

With these three scripts, you should be able to run SiteManager in your XenApp environment!



Previous

Not Working Fedora 29 to 5 – Updated!

Next

Path To Enlightened-ment

2 Comments

  1. Regards for helping out, fantastic information. “Courage comes and goes. Hold on for the next supply.” by Vicki Baum.

  2. Hello, I wish for to subscribe for this weblog to get most up-to-date updates, thus where can i do it please help.

Leave a Reply

Your email address will not be published. Required fields are marked *

Powered by WordPress & Theme by Anders Norén