FREQUENTLY ASK QUESTIONS

YOU CAN SEARCH PART OF THE TEXT OR NUMBER.

CAQdesktop operation on VPN


To optimize the launch of the application via VPN, it is possible to place the complete CAQdesktop directory on the user's local disk and thus greatly increase the start up speed of the application. The application itself will only download data from the MSSQL server via VPN. It is also a good idea to set a default filter for a specific module to limit the amount of data to load at startup.

However, this boot solution complicates the actual upgrade of the CAQdesktop application, where it is necessary to ensure the same versions on all stations. One option is to use the script below, which users will use to launch the application. The script checks and compares the local network directories with the application and and according to that decides whether it is necessary to update the local copy from which it then starts the program itself.

Conditions for deployment

  • The script works by comparing the /APL/release.xml file, which determines and identifies the version. Please note, when using versions, that don't have this file (PreRelease) the script cannot be used.
  • To deploy the script, it is necessary to deploy the  CAQservice in the network environment, taking care of global distibution of the configuration, otherwise the installation will be incorrectly activated and operational problems will occur.

 

Termination of work on client stations

When performing an update on the server, it is necessary to indentify users currently working with Palstat CAQdesktop and promt them to close the application on local stations, otherwise there may arrise a situation where the databsae structure on the server changes and an applicatation that has not been updated may lead an unpredictable error state.

The list of users currently working in the system can be located using the apllication ./APL/CaqAdmin.exe under the "License" tab, see screenshot.

 

Deploying PowerShell script

  • Place the script below on the client station, for example in the directory "c:/Palstat3G_local_production/"
  • Name the script "RUN_Palstat.ps1"
  • Modify script to match your production environment with the values "$sourcePalstatDir", "$targetPalstatDir"
  • Create a shortcut in the same directory that will run the approriate PowerShell, see. screenshot, for increased user comfort the shortcut can be assigned an icon of the application.
  • The Script respects optional argument with the name of the application you want to run. In the screenshot you can see the settings of the shortcut for running the "Gauges", the name of the argument corresponds to the EXE file in the APL directory.
  • The deployment at the representative must look like the example with an adjustment to real values.
    • (C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -ExecutionPolicy Bypass -File "c:/Palstat3G_local_production/RUN_Palstat.ps1")
    • There are many ways to run PowerShell on client workstations, depending on the local policy of each company.
    • The shortcut icon can also be edited but it must be directed to a local copy.
  • Optionally, argument script if not chosen leads to running a default  ./APL/Launcher.exe
  • Optionally, the script looks for a file /CONFIG/config.LocalClient.xml, in the network location, if the file is found it is copied to a local location as /CONFIG/config.xml, you can enter another IP address of the server with the service in this file so that is is visible for users via VPN.

Sample shortcut content for the  "Destination" field

Launch the Launcher

C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -ExecutionPolicy Bypass -File "c:/Palstat3G_local_production/RUN_Palstat.ps1"

Starting the Gauges module
inserting the module name at the end of the  "measures" command corresponds to the name according to the EXE files in the APL directory.

C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -ExecutionPolicy Bypass -File "c:/Palstat3G_local_production/RUN_Palstat.ps1" measures

Download sample shortcuts in ZIP format

 

Example of a local directory on a client station, shortcuts can be placed on a network drive for easier management, or extended script and copied shortcuts from a network drive to local workstations.

 

 

 

 

 

 

 

 

 

 

PowerShell for a local copy of Palstat CAQdesktop

cls
<#
v1.3 - add Set-Location
v1.2 - accept custom config.xml file for local users
v1.1 - external argument as runable programm
v1.0 - first release
#>

$sourcePalstatDir = "//10.0.01/VPN/Palstat3G/";         # demand   # network directory of CAQdesktop
$targetPalstatDir = "c:/Palstat3G_local_production/";   # demand   # local directory
$targetPalstatClientConfig = "config.LocalClient.xml";  # optional # name of custom config file for users with local copy of CAQdesktop


$sourcePalstatRelease = $sourcePalstatDir + "APL/release.xml";
$targetPalstatRelease = $targetPalstatDir + "APL/release.xml";



"
-----------------------------------------------------------------
-  PalstatCAQ LOCAL COPY CHECK                     
-  compare, copy, run both Palstat Directory  
-  ergument represent name of module exp: 'measures'
-
-  SOURCE:    $sourcePalstatDir
-  TARGET:    $targetPalstatDir
-  ARGUMENTS: $($args.count)
-----------------------------------------------------------------
"


if ( $($args.count) -eq 1 ) {
    $arg_file = $sourcePalstatDir+"APL/"+$($args[0])+".exe";
    $arg_file2 = $targetPalstatDir+"APL/"+$($args[0])+".exe";
    "[I]: Script accepted argument"
    "[I]: Argument -> $($args[0])"
    "[I]: Argument -> $arg_file"

    #hledame zda takovy soubor vubec existuje
    if (!(Test-Path $arg_file) -and !(Test-Path $arg_file2) ) {
        "[E]: Argument -> file not exist -> $arg_file"
        exit;
    }else{
        $_run_argument = $arg_file2;
    }

}else{
    $_run_argument = "NO";
}



"[I]: Check release.xml files in source and target directory"

if (!(Test-Path $targetPalstatRelease) ) {
  "[W]: NOT EXIST Target Directory '$targetPalstatDir'"

  New-Item -Path "$targetPalstatDir" -Name "APL" -ItemType "directory" | Out-Null
  New-Item -Path "$targetPalstatDir/APL/" -Name "release.xml" -ItemType "file" -Value "First RUN" | Out-Null
  "[I]: Directory Created"
}


if (!(Test-Path $sourcePalstatRelease) ) {
  "[E]: NOT EXIST -> $sourcePalstatRelease"
   exit;
}

if (!(Test-Path $targetPalstatRelease) ) {
  "[E]: NOT EXIST -> $targetPalstatRelease"
}

"[I]: OK"

if(Compare-Object -ReferenceObject $(Get-Content $targetPalstatRelease) -DifferenceObject $(Get-Content $sourcePalstatRelease)){
    "[I]: Versions are different, copy actual from server!!!"



    if ((Test-Path "$targetPalstatDir/APLOLD/") ) {       
        Remove-Item "$targetPalstatDir/APLOLD/" -Recurse
    }

    #### zkusime prejmenovat jestli neni slozka nekym drzena
    if ((Test-Path "$targetPalstatDir/APL/") ) {    
     "[I]: Old APL exist, try rename to check if isnt block"
     Rename-Item -path "$targetPalstatDir/APL" -newName "$targetPalstatDir/APLOLD" | Out-Null

     if (!(Test-Path "$targetPalstatDir/APLOLD/") ) {       
        "[E]: unable rename '$targetPalstatDir/APL', some application is open?"
        exit;
     }

    }   
    


    if ((Test-Path "$targetPalstatDir/CONFIG/") ) {     
        "[I]: Delete Dir CONFIG - done"  
        Remove-Item "$targetPalstatDir/CONFIG/" -Recurse
    }
    New-Item -Path "$targetPalstatDir" -Name "CONFIG" -ItemType "directory" | Out-Null


    if ((Test-Path "$targetPalstatDir/APL/") ) {
        "[I]: Delete Dir APL    - done"
        Remove-Item "$targetPalstatDir/APL/" -Recurse
    }
    New-Item -Path "$targetPalstatDir" -Name "APL" -ItemType "directory" | Out-Null


    if ((Test-Path "$targetPalstatDir/DOC/") ) {       
        "[I]: Delete Dir DOC    - done"
        Remove-Item "$targetPalstatDir/DOC/" -Recurse
    }
    New-Item -Path "$targetPalstatDir" -Name "DOC" -ItemType "directory" | Out-Null


    if ((Test-Path "$targetPalstatDir/SETUP/") ) {       
        "[I]: Delete Dir SETUP  - done"
        Remove-Item "$targetPalstatDir/SETUP/" -Recurse
    }
    New-Item -Path "$targetPalstatDir" -Name "SETUP" -ItemType "directory" | Out-Null


    Copy-Item -Path "$sourcePalstatDir/CONFIG/*" -Destination "$targetPalstatDir/CONFIG" -Recurse
    "[I]: Copy Dir CONFIG - done"
    
    Copy-Item -Path "$sourcePalstatDir/SETUP/*" -Destination "$targetPalstatDir/SETUP" -Recurse
    "[I]: Copy Dir SETUP  - done"

    Copy-Item -Path "$sourcePalstatDir/DOC/*" -Destination "$targetPalstatDir/DOC" -Recurse
    "[I]: Copy Dir DOC    - done"

    Copy-Item -Path "$sourcePalstatDir/APL/*" -Destination "$targetPalstatDir/APL" -Recurse
    "[I]: Copy Dir APL    - done"
    


}


#run CAQdesktop from local destination
if ((Test-Path $targetPalstatRelease) ) {
  if  ( !([string]::IsNullOrWhitespace($targetPalstatClientConfig)) ) {
    "[I]: Local custom config file -> defined"
    $customCfg = $sourcePalstatDir+"CONFIG/"+$targetPalstatClientConfig;
     if  ((Test-Path $customCfg) ) {
           "[I]: Local custom config file -> delete old file from local destination"
           Remove-Item "$targetPalstatDir/CONFIG/config.xml" | Out-Null

           "[I]: Local custom config file -> copy to local destination"
           Copy-Item -Path "$customCfg" -Destination "$targetPalstatDir/CONFIG/config.xml" | Out-Null

    }else{
        "[W]: Local custom config file -> defined but not exist "+$customCfg
    }
  }else{
    "[I]: Local custom config file -> NOdefined"
  }

    Set-Location "$targetPalstatDir/APL"
    if ( $_run_argument -eq "NO" ){
        "[I]: Versions are same, RUN LAUNCHER"
        &"$targetPalstatDir/APL/Launcher.exe"
    }else{
        "[I]: Versions are same, RUN ARGUMENT"
        &$_run_argument
    }
 
}

##

 

 

 

The process of starting the shortcut during the first start

https://www.palstat.cz/