Problems installing RSEE on remote PC

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
wartech
Posts: 48
Joined: Sun Jan 13, 2008 8:30 pm

Problems installing RSEE on remote PC

Post by wartech »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.162
OS: Windows 10 Pro (64 Bit)
Build: v10.0.17763.0

*** Please add details and screenshots as needed below. ***

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

I modified a script at the end of last week, repackaged it (for a Windows 7 PC), and copied it to the remote PC.
It wouldn't run.
Before the console window vanished I managed to grab a screenshot of it: there were numerous missing parenthesis & unexpected character errors.
All I had changed was the contents of a regexp to deal with a new format of our SKUs.
I checked the script on my PC - it works fine.

Just in case I had done something stupid (apart from overwriting the working exe) I set the script back to how it was & repackaged.
It still doesn't work on the PC where it's needed!
So I need to set up RSEE as soon as possible to try and figure out how it's broken.

My question is this:
Where in the PowerShell Studio 2019 manual are the instructions for installing the RSEE Service 2019?
I just get PrimalHost64.dll failed to register. HRESULT -214711024770 (same for the 32 bit version as well).

I really need to get this fixed before tomorrow morning if I can.
Many thanks.

User avatar
Alexander Riedel
Posts: 7500
Joined: Tue May 29, 2007 4:43 pm

Re: Problems installing RSEE on remote PC

Post by Alexander Riedel »

The install *should* be as simple as running the installer, the PrimalHost dll needs the Visual Studio 2019 runtime installed though.
I'll look into what that HRESULT means. In the meantime, please post that screenshot, your packaging options and some details about the OS where it fails.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
wartech
Posts: 48
Joined: Sun Jan 13, 2008 8:30 pm

Re: Problems installing RSEE on remote PC

Post by wartech »

OK - that's one piece of the puzzle solved:
I followed the latest piece of advice that I could find in your forums, and installed the C++ 2012 redistributable.

Thanks
More info to follow, hopefully.

User avatar
wartech
Posts: 48
Joined: Sun Jan 13, 2008 8:30 pm

Re: Problems installing RSEE on remote PC

Post by wartech »

Looks like the latest C++ redist is 2017 (please correct me if I'm wrong):
https://support.microsoft.com/en-gb/hel ... -downloads

I was wrong about it working on my PC - I only tested that the script is working.
I assumed that if the script ran, then the exe would too (Doh!).
If I run the exe on my PC, nothing happens. What it should do is open a command window and prompt for a works order number (or 'x' to quit).
Unfortunately I printed the screen capture without saving it.
Only a fraction of the error message was captured - there were too many errors to fit the window, but from what I can see the errors seem to be meaningless.

For example the 1st error that I can see complains of unexpected token 'Works' in expression or statement at line 185 char 3.
LInes 180 through 188 are a comment block; the original commands there provided an on screen progress summary, but I was asked to remove it.
  1. <#  Commented out - feedback not currently required
  2.  
  3.     '' # A bit of feedback
  4.  
  5.     '----------------------------------------------------------------------------------------'
  6.  
  7.     "Works Order : $wo  Part Number: $part  Sales Order: $so    Customer: $cust"
  8.  
  9.     "Qty         : $origqty"
  10.  
  11.     "Done Date   : $donedate"
  12.  
  13.     "Status      : $status"
  14.  
  15.     ''
  16.  
  17. #>
With C++ 2017 (both x86 & x64) on the Win7 PC, the x86 RSEE installs without any messages.
The x64 RSEE install throws up 3 command windows with error messages in - so far they've disappeared too fast for me to capture any of them.
The only part I managed to read was RegAsm warning.

User avatar
wartech
Posts: 48
Joined: Sun Jan 13, 2008 8:30 pm

Re: Problems installing RSEE on remote PC

Post by wartech »

OK got the exe to run on my PC. Just going to try it on the Win7 PC (it's quite a long walk though).
I updated to the latest version of PowerShell Studio a couple of weeks ago.
Earlier today I noticed there was a newer version, so updated.

I just noticed that when I repackaged the script after today's update there was a message in the 'Tools Output' panel saying the exe file could not be overwritten.
I don't recall ever seeing this before.
I renamed the old file to "Print-BoxLabel.exe.saved" and everything was OK again (repackaging worked).
Anyway, the exe now runs on my PC as I would expect it to.

If I repackage again it now works without any problems or error messages.
Last edited by wartech on Tue Apr 23, 2019 4:20 am, edited 1 time in total.

User avatar
wartech
Posts: 48
Joined: Sun Jan 13, 2008 8:30 pm

Re: Problems installing RSEE on remote PC

Post by wartech »

All good on the Win7 PC as well.
In case it's of any use, here's the script:
  1. <# 
  2.  
  3.     .NOTES
  4.  
  5.     ===========================================================================
  6.  
  7.      Created with:  SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.95
  8.  
  9.      Created on:    03/08/2015 18:55
  10.  
  11.  
  12.  
  13.      Created by:    Phil Sharpe
  14.  
  15.      Organization:  Norbar Torque Tools Ltd.
  16.  
  17.      Filename:      Print-BoxLabel.ps1
  18.  
  19.     ===========================================================================
  20.  
  21.     .DESCRIPTION
  22.  
  23.         Print Kiaro box labels from Works Order details.
  24.  
  25.         Currently runs on Windows 7 SP1 / Windows 10 (PowerShell 4 or above)
  26.  
  27.             - untested on anything else.
  28.  
  29.         PrintServer PC is hardcoded to NBW001124.
  30.  
  31.         It is not advisable to run from any other PC without checking the label stock loaded in each printer.
  32.  
  33.        
  34.  
  35.         SQL Server is Microsoft SQL Server 2008 Standard Edition (64-bit)
  36.  
  37.  
  38.  
  39.         Program Inputs:
  40.  
  41.             1. Works order number (scanned from barcode)
  42.  
  43.                 The inventory code and req'd qty are retrieved from the
  44.  
  45.                 Norbar_Production database using the W/O number.
  46.  
  47.                 Function: Read-WO
  48.  
  49.             2. Printer number - currently 1, 2 or 3.
  50.  
  51.                 Function: Read-Printer
  52.  
  53.                 Used to construct the printer name
  54.  
  55.  
  56.  
  57.         For an audible warning of invalid input data, the Windows system
  58.  
  59.         sound "Question" (not normally used) should be set to a suitable
  60.  
  61.         WAV file. Currently set to a WWII submarine dive alarm.
  62.  
  63. #>
  64.  
  65.  
  66.  
  67. Add-Type -AssemblyName System.Data
  68.  
  69.  
  70.  
  71. function Show-ErrorBox ($errTitle, $errMsg)
  72.  
  73. {
  74.  
  75.     [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
  76.  
  77.     [Windows.Forms.MessageBox]::Show($errMsg, $errTitle, [Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error, [System.Windows.Forms.MessageBoxDefaultButton]::Button1, [System.Windows.Forms.MessageBoxOptions]::DefaultDesktopOnly) | Out-Null
  78.  
  79. }
  80.  
  81.  
  82.  
  83. function Read-WO
  84.  
  85. {
  86.  
  87.     # Enter Works Order number
  88.  
  89.     # This must start with 3 followed by 6 digits
  90.  
  91.     $iWarning = 'Enter Works Order number (x to end)'
  92.  
  93.     $badInput = $false
  94.  
  95.     Do
  96.  
  97.     {
  98.  
  99.         if ($badInput)
  100.  
  101.         {
  102.  
  103.             [System.Media.SystemSounds]::Question.Play() | Out-Null
  104.  
  105.         }
  106.  
  107.         [string]$worksOrder = (Read-Host -Prompt $iWarning).Replace(" ", "").ToUpper()
  108.  
  109.         if ($worksOrder -eq "X")
  110.  
  111.         {
  112.  
  113.             Return "X"
  114.  
  115.         }
  116.  
  117.         $iWarning = 'Invalid Works Order. Please re-enter Works Order (x to end)'
  118.  
  119.         $badInput = $true
  120.  
  121.     }
  122.  
  123.     while ($worksOrder -notmatch '^3\d{6}$')
  124.  
  125.     Return $worksOrder
  126.  
  127. }
  128.  
  129.  
  130.  
  131. function Read-Printer
  132.  
  133. {
  134.  
  135.     # Enter Printer number
  136.  
  137.     # Currently this must be 1, 2 or 3
  138.  
  139.     $iWarning = 'Enter Kiaro Printer number (1, 2 or 3)'
  140.  
  141.     $badInput = $false
  142.  
  143.     Do
  144.  
  145.     {
  146.  
  147.         if ($badInput)
  148.  
  149.         {
  150.  
  151.             [System.Media.SystemSounds]::Question.Play() | Out-Null
  152.  
  153.         }
  154.  
  155.         [string]$iPrinter = (Read-Host -Prompt $iWarning).Replace(" ", "")
  156.  
  157.         $iWarning = 'Invalid Printer number. Please enter 1, 2 or 3'
  158.  
  159.         $badInput = $true
  160.  
  161.     }
  162.  
  163.     while ($iPrinter -notin '1', '2', '3')
  164.  
  165.    
  166.  
  167.     $iPS = "PRINTER=QuickLabel Kiaro ;Kiaro!" #Base printer name
  168.  
  169.     switch ($iPrinter)
  170.  
  171.     {
  172.  
  173.         1 { $iPS = $iPS.Replace(" ;", " 1;") }
  174.  
  175.         2 { $iPS = $iPS.Replace(" ;", " 2;") }
  176.  
  177.         3 { $iPS = $iPS.Replace(" ;", " 3;") }
  178.  
  179.     }
  180.  
  181.     Return $iPS
  182.  
  183. }
  184.  
  185.  
  186.  
  187.  
  188.  
  189. # Processing starts here
  190.  
  191.  
  192.  
  193. #region Initialize
  194.  
  195.  
  196.  
  197. #The QuickCommand process on the print server monitors the Monitor$ share for new print command files
  198.  
  199. $printSrvr = 'NBW001124' #PC with QuickCommand & Kiaros connected
  200.  
  201. $quickCommand = 'C:\Program Files (x86)\Custom QuickLabel\QuickCommand.exe'
  202.  
  203. if ($env:COMPUTERNAME -ine $printSrvr)
  204.  
  205. {
  206.  
  207.     #Firing up QuickCommand remotely - Hope you know what you're doing!
  208.  
  209.     $printing = "Remote"
  210.  
  211.     $quickCommand += ' /S'
  212.  
  213.     if ((Get-CimInstance -Query 'Select * from Win32_Process where name like "quickcommand%"' -ComputerName $printSrvr | Measure-Object).Count -eq 0)
  214.  
  215.     {
  216.  
  217.         Invoke-CimMethod –ClassName Win32_Process -Computer $printSrvr –Method "Create" –Arg @{ CommandLine = $quickCommand }
  218.  
  219.     }
  220.  
  221.     $monitor = '\\NBW001124\Monitor$' #This is a pre-created invisible share
  222.  
  223. }
  224.  
  225. else
  226.  
  227. {
  228.  
  229.     #We're running locally - Much safer (in terms of fewer scrapped labels)
  230.  
  231.     $printing = "Local"
  232.  
  233.     if ((Get-Process | Where-Object Name -eq quickcommand).Count -eq 0)
  234.  
  235.     {
  236.  
  237.         Start-Process -FilePath $quickCommand -ArgumentList '/S'
  238.  
  239.     }
  240.  
  241.     $monitor = 'C:\Users\Public\Documents\Custom QuickLabel\QuickCommand\Monitor'
  242.  
  243. }
  244.  
  245.  
  246.  
  247. $lblRoot = "\\FS1\AssyLabels\ALF Files\Kiaro" #Root folder for our label files
  248.  
  249. if ((Test-Path -Path $lblRoot -PathType Container) -eq $false)
  250.  
  251. {
  252.  
  253.     $lblRoot = "\\FS2\AssyLabels\ALF Files\Kiaro"
  254.  
  255.     if ((Test-Path -Path $lblRoot -PathType Container) -eq $false)
  256.  
  257.     {
  258.  
  259.         throw "Fatal error - Cannot access label folder"
  260.  
  261.     }
  262.  
  263. }
  264.  
  265.  
  266.  
  267. $lblDblRow = @('26771', '26773', '26981', '266105') #Label stock with 2 labels per row
  268.  
  269. $crlf = [char]13 + [char]10
  270.  
  271.  
  272.  
  273. #Set up database access
  274.  
  275. $dbUser = "UID=*******"
  276.  
  277. $dbPass = "Pwd=**************"
  278.  
  279. $server = "Server=dbserv"
  280.  
  281. $database = "Database=NORBAR_PRODUCTION"
  282.  
  283. $conn = New-Object System.Data.SqlClient.SqlConnection("$server;$database;$dbUser;$dbPass")
  284.  
  285. $conn.Open() | Out-Null
  286.  
  287. #endregion
  288.  
  289.  
  290.  
  291.  
  292.  
  293. do
  294.  
  295. {
  296.  
  297.     $worksOrder = Read-WO #Get works order number
  298.  
  299.     if ($worksOrder -eq 'X')
  300.  
  301.     {
  302.  
  303.         continue
  304.  
  305.     }
  306.  
  307.    
  308.  
  309.     #SQL query
  310.  
  311.     $query = @'
  312.  
  313.     SELECT [WOR_ORDER]
  314.  
  315.      ,[WOR_ITEM_ONLY]
  316.  
  317.      ,[WOR_SALORD]
  318.  
  319.      ,[WOR_CUSTOMER]
  320.  
  321.      ,[WOR_ORIG_QTY]
  322.  
  323.      ,[WOR_DONE_DATE]
  324.  
  325.      ,[WOR_STATUS]
  326.  
  327.     FROM [NORBAR_PRODUCTION].[dbo].[vwASC_WORTBL]
  328.  
  329.     WHERE WOR_ORDER = {0}
  330.  
  331. '@ -f "'" + $worksOrder + "'"
  332.  
  333.    
  334.  
  335.     $command = New-Object System.Data.Sqlclient.SqlCommand($query)
  336.  
  337.     $command.Connection = $conn
  338.  
  339.     $DR = $command.Executereader()
  340.  
  341.     $DR.Read() | Out-Null
  342.  
  343.     $wo = $DR.GetValue(0) # Works order number
  344.  
  345.     $part = $DR.GetValue(1) # Part number
  346.  
  347.     $so = $DR.GetValue(2) # Sales order number
  348.  
  349.     $cust = $DR.GetValue(3) # Customer code
  350.  
  351.     $origQty = $DR.GetValue(4) # Qty reqd
  352.  
  353.     $doneDate = $DR.GetValue(5) # Date the W/O was closed (should be empty)
  354.  
  355.     $status = $DR.GetValue(6) # Open/Closed status
  356.  
  357.     $DR.Close()
  358.  
  359.    
  360.  
  361. <#  Commented out - feedback not currently required
  362.  
  363.     '' # A bit of feedback
  364.  
  365.     '----------------------------------------------------------------------------------------'
  366.  
  367.     "Works Order : $wo  Part Number: $part  Sales Order: $so    Customer: $cust"
  368.  
  369.     "Qty         : $origqty"
  370.  
  371.     "Done Date   : $donedate"
  372.  
  373.     "Status      : $status"
  374.  
  375.     ''
  376.  
  377. #> 
  378.  
  379.    
  380.  
  381.     # Dealing with our "special" way of numbering parts
  382.  
  383.     # and our "unique" way of naming labels, e.g. "26671_13070_NOR Iss1 Apr09.alf"
  384.  
  385.     $part = $part.Trim().ToUpper() #Convert to uppercase without spaces
  386.  
  387.     if ($part -match '^.{4,6}R$|.+R\.\d{2}') #Remove 'R' from the end of service replacement part codes
  388.  
  389.     {
  390.  
  391.         $part = $part.Replace('R', '')
  392.  
  393.     }
  394.  
  395.     if ($part.EndsWith('.01') -or $part -notmatch '.{4,6}\.[A-Z]{3}$') #Add _NOR to non own brand part codes
  396.  
  397.     {
  398.  
  399.         $part += '_NOR'
  400.  
  401.     }
  402.  
  403.     $part = $part.Replace(".", "_") #Replace dots with underscores (blame Marketing)
  404.  
  405.     $lblFilter = -join ('*_', $part, '*') #Throw in some super stars (wildcard it) to make a file name filter
  406.  
  407.    
  408.  
  409.    
  410.  
  411.     # Search for label files matching our part number from the label root folder down
  412.  
  413.     # excluding anything in folders named 'Obsolete'
  414.  
  415.     $lblFound = Get-ChildItem -File -Path $lblRoot -Recurse -Include *.alf -Filter $lblFilter | Where-Object fullname -NotMatch Obsolete
  416.  
  417.    
  418.  
  419.     switch ($lblFound.Count) #Action depends on how many label files we matched
  420.  
  421.     {
  422.  
  423.         0 #Did someone steal my label?
  424.  
  425.         {
  426.  
  427.             'No labels found for this part - Cannot print'
  428.  
  429.         }
  430.  
  431.         1 #Perfect
  432.  
  433.         {
  434.  
  435.             "Printing label $lblFound"
  436.  
  437.             $lblStock = ($lblFound.Name -split "_", 2)[0] #1st part of filename before the "_"
  438.  
  439.             $lblRows = 1
  440.  
  441.             if ($lblStock -in $lblDblRow) #How many labels per row?
  442.  
  443.             {
  444.  
  445.                 $lblRows = 2
  446.  
  447.             }
  448.  
  449.             switch ($lblRows) #Calculate the number of rows of labels to print
  450.  
  451.             {
  452.  
  453.                 1 { $printCount = [int16]$origQty }
  454.  
  455.                 2 { $printCount = [int16][math]::Truncate(($origQty/2) + 0.5) }
  456.  
  457.             }
  458.  
  459.             $printString = Read-Printer #Select a printer
  460.  
  461.             $pfContent  = 'LABELNAME=' + $lblFound.FullName + $crlf
  462.  
  463.             $pfContent += 'LABELQUANTITY=' + $printCount + $crlf
  464.  
  465.             $pfContent += $printString + $crlf
  466.  
  467.            
  468.  
  469.             $pfName = $monitor + '\' + $worksOrder + '_' + [int16]$origQty + ' x ' + $part + '.acf'
  470.  
  471.             if (Test-Path -Path $pfName)
  472.  
  473.             {
  474.  
  475.                 throw "Fatal error - Another copy of the print instruction file already exists"
  476.  
  477.             }
  478.  
  479.            
  480.  
  481.             # Stream label to destination file
  482.  
  483.             $stream = New-Object -ComObject ADODB.Stream
  484.  
  485.             $stream.Charset = "utf-8"
  486.  
  487.             $stream.Open()
  488.  
  489.             $stream.WriteText($pfContent)
  490.  
  491.             $stream.SaveToFile($pfName)
  492.  
  493.             $stream.Close()
  494.  
  495.             <# User wants less on-screen feedback
  496.  
  497.             ''
  498.  
  499.             "Label $pfName printed to $printing $printString"
  500.  
  501.             #>
  502.  
  503.         }
  504.  
  505.         default #Oops. More than 1 label found
  506.  
  507.         {
  508.  
  509.             "Found $($lblFound.Count) labels:"
  510.  
  511.             $lblFound
  512.  
  513.             'Cannot print - There can be only one! (label per part number)'
  514.  
  515.         }
  516.  
  517.     }
  518.  
  519.     ''
  520.  
  521.     ''
  522.  
  523. }
  524.  
  525. until ($worksOrder -eq 'X')
  526.  
  527.  
  528.  
  529. $conn.Close | Out-Null

User avatar
wartech
Posts: 48
Joined: Sun Jan 13, 2008 8:30 pm

Re: Problems installing RSEE on remote PC

Post by wartech »

(Apologies for combining 2 issues in the same post yesterday - drives me mad when my colleagues do that :oops: )
I reinstalled RSEE over & over until I captured one of the message popups (must be an easier way):
Regasm.png
Regasm.png (47.49 KiB) Viewed 2889 times
So: it's only a warning & not an error, and the event log confirms that the install succeeded.
All now copacetic.