Page 1 of 1

Problems installing RSEE on remote PC

Posted: Mon Apr 22, 2019 7:08 am
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.

Re: Problems installing RSEE on remote PC

Posted: Mon Apr 22, 2019 7:32 am
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.

Re: Problems installing RSEE on remote PC

Posted: Mon Apr 22, 2019 11:45 am
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.

Re: Problems installing RSEE on remote PC

Posted: Mon Apr 22, 2019 1:10 pm
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.     '' # A bit of feedback
  3.     '----------------------------------------------------------------------------------------'
  4.     "Works Order : $wo  Part Number: $part  Sales Order: $so    Customer: $cust"
  5.     "Qty         : $origqty"
  6.     "Done Date   : $donedate"
  7.     "Status      : $status"
  8.     ''
  9. #>
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.

Re: Problems installing RSEE on remote PC

Posted: Mon Apr 22, 2019 1:28 pm
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.

Re: Problems installing RSEE on remote PC

Posted: Mon Apr 22, 2019 2:20 pm
by wartech
All good on the Win7 PC as well.
In case it's of any use, here's the script:
  1. <# 
  2.     .NOTES
  3.     ===========================================================================
  4.      Created with:  SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.95
  5.      Created on:    03/08/2015 18:55
  6.  
  7.      Created by:    Phil Sharpe
  8.      Organization:  Norbar Torque Tools Ltd.
  9.      Filename:      Print-BoxLabel.ps1
  10.     ===========================================================================
  11.     .DESCRIPTION
  12.         Print Kiaro box labels from Works Order details.
  13.         Currently runs on Windows 7 SP1 / Windows 10 (PowerShell 4 or above)
  14.             - untested on anything else.
  15.         PrintServer PC is hardcoded to NBW001124.
  16.         It is not advisable to run from any other PC without checking the label stock loaded in each printer.
  17.        
  18.         SQL Server is Microsoft SQL Server 2008 Standard Edition (64-bit)
  19.  
  20.         Program Inputs:
  21.             1. Works order number (scanned from barcode)
  22.                 The inventory code and req'd qty are retrieved from the
  23.                 Norbar_Production database using the W/O number.
  24.                 Function: Read-WO
  25.             2. Printer number - currently 1, 2 or 3.
  26.                 Function: Read-Printer
  27.                 Used to construct the printer name
  28.  
  29.         For an audible warning of invalid input data, the Windows system
  30.         sound "Question" (not normally used) should be set to a suitable
  31.         WAV file. Currently set to a WWII submarine dive alarm.
  32. #>
  33.  
  34. Add-Type -AssemblyName System.Data
  35.  
  36. function Show-ErrorBox ($errTitle, $errMsg)
  37. {
  38.     [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
  39.     [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
  40. }
  41.  
  42. function Read-WO
  43. {
  44.     # Enter Works Order number
  45.     # This must start with 3 followed by 6 digits
  46.     $iWarning = 'Enter Works Order number (x to end)'
  47.     $badInput = $false
  48.     Do
  49.     {
  50.         if ($badInput)
  51.         {
  52.             [System.Media.SystemSounds]::Question.Play() | Out-Null
  53.         }
  54.         [string]$worksOrder = (Read-Host -Prompt $iWarning).Replace(" ", "").ToUpper()
  55.         if ($worksOrder -eq "X")
  56.         {
  57.             Return "X"
  58.         }
  59.         $iWarning = 'Invalid Works Order. Please re-enter Works Order (x to end)'
  60.         $badInput = $true
  61.     }
  62.     while ($worksOrder -notmatch '^3\d{6}$')
  63.     Return $worksOrder
  64. }
  65.  
  66. function Read-Printer
  67. {
  68.     # Enter Printer number
  69.     # Currently this must be 1, 2 or 3
  70.     $iWarning = 'Enter Kiaro Printer number (1, 2 or 3)'
  71.     $badInput = $false
  72.     Do
  73.     {
  74.         if ($badInput)
  75.         {
  76.             [System.Media.SystemSounds]::Question.Play() | Out-Null
  77.         }
  78.         [string]$iPrinter = (Read-Host -Prompt $iWarning).Replace(" ", "")
  79.         $iWarning = 'Invalid Printer number. Please enter 1, 2 or 3'
  80.         $badInput = $true
  81.     }
  82.     while ($iPrinter -notin '1', '2', '3')
  83.    
  84.     $iPS = "PRINTER=QuickLabel Kiaro ;Kiaro!" #Base printer name
  85.     switch ($iPrinter)
  86.     {
  87.         1 { $iPS = $iPS.Replace(" ;", " 1;") }
  88.         2 { $iPS = $iPS.Replace(" ;", " 2;") }
  89.         3 { $iPS = $iPS.Replace(" ;", " 3;") }
  90.     }
  91.     Return $iPS
  92. }
  93.  
  94.  
  95. # Processing starts here
  96.  
  97. #region Initialize
  98.  
  99. #The QuickCommand process on the print server monitors the Monitor$ share for new print command files
  100. $printSrvr = 'NBW001124' #PC with QuickCommand & Kiaros connected
  101. $quickCommand = 'C:\Program Files (x86)\Custom QuickLabel\QuickCommand.exe'
  102. if ($env:COMPUTERNAME -ine $printSrvr)
  103. {
  104.     #Firing up QuickCommand remotely - Hope you know what you're doing!
  105.     $printing = "Remote"
  106.     $quickCommand += ' /S'
  107.     if ((Get-CimInstance -Query 'Select * from Win32_Process where name like "quickcommand%"' -ComputerName $printSrvr | Measure-Object).Count -eq 0)
  108.     {
  109.         Invoke-CimMethod –ClassName Win32_Process -Computer $printSrvr –Method "Create" –Arg @{ CommandLine = $quickCommand }
  110.     }
  111.     $monitor = '\\NBW001124\Monitor$' #This is a pre-created invisible share
  112. }
  113. else
  114. {
  115.     #We're running locally - Much safer (in terms of fewer scrapped labels)
  116.     $printing = "Local"
  117.     if ((Get-Process | Where-Object Name -eq quickcommand).Count -eq 0)
  118.     {
  119.         Start-Process -FilePath $quickCommand -ArgumentList '/S'
  120.     }
  121.     $monitor = 'C:\Users\Public\Documents\Custom QuickLabel\QuickCommand\Monitor'
  122. }
  123.  
  124. $lblRoot = "\\FS1\AssyLabels\ALF Files\Kiaro" #Root folder for our label files
  125. if ((Test-Path -Path $lblRoot -PathType Container) -eq $false)
  126. {
  127.     $lblRoot = "\\FS2\AssyLabels\ALF Files\Kiaro"
  128.     if ((Test-Path -Path $lblRoot -PathType Container) -eq $false)
  129.     {
  130.         throw "Fatal error - Cannot access label folder"
  131.     }
  132. }
  133.  
  134. $lblDblRow = @('26771', '26773', '26981', '266105') #Label stock with 2 labels per row
  135. $crlf = [char]13 + [char]10
  136.  
  137. #Set up database access
  138. $dbUser = "UID=*******"
  139. $dbPass = "Pwd=**************"
  140. $server = "Server=dbserv"
  141. $database = "Database=NORBAR_PRODUCTION"
  142. $conn = New-Object System.Data.SqlClient.SqlConnection("$server;$database;$dbUser;$dbPass")
  143. $conn.Open() | Out-Null
  144. #endregion
  145.  
  146.  
  147. do
  148. {
  149.     $worksOrder = Read-WO #Get works order number
  150.     if ($worksOrder -eq 'X')
  151.     {
  152.         continue
  153.     }
  154.    
  155.     #SQL query
  156.     $query = @'
  157.     SELECT [WOR_ORDER]
  158.      ,[WOR_ITEM_ONLY]
  159.      ,[WOR_SALORD]
  160.      ,[WOR_CUSTOMER]
  161.      ,[WOR_ORIG_QTY]
  162.      ,[WOR_DONE_DATE]
  163.      ,[WOR_STATUS]
  164.     FROM [NORBAR_PRODUCTION].[dbo].[vwASC_WORTBL]
  165.     WHERE WOR_ORDER = {0}
  166. '@ -f "'" + $worksOrder + "'"
  167.    
  168.     $command = New-Object System.Data.Sqlclient.SqlCommand($query)
  169.     $command.Connection = $conn
  170.     $DR = $command.Executereader()
  171.     $DR.Read() | Out-Null
  172.     $wo = $DR.GetValue(0) # Works order number
  173.     $part = $DR.GetValue(1) # Part number
  174.     $so = $DR.GetValue(2) # Sales order number
  175.     $cust = $DR.GetValue(3) # Customer code
  176.     $origQty = $DR.GetValue(4) # Qty reqd
  177.     $doneDate = $DR.GetValue(5) # Date the W/O was closed (should be empty)
  178.     $status = $DR.GetValue(6) # Open/Closed status
  179.     $DR.Close()
  180.    
  181. <#  Commented out - feedback not currently required
  182.     '' # A bit of feedback
  183.     '----------------------------------------------------------------------------------------'
  184.     "Works Order : $wo  Part Number: $part  Sales Order: $so    Customer: $cust"
  185.     "Qty         : $origqty"
  186.     "Done Date   : $donedate"
  187.     "Status      : $status"
  188.     ''
  189. #> 
  190.    
  191.     # Dealing with our "special" way of numbering parts
  192.     # and our "unique" way of naming labels, e.g. "26671_13070_NOR Iss1 Apr09.alf"
  193.     $part = $part.Trim().ToUpper() #Convert to uppercase without spaces
  194.     if ($part -match '^.{4,6}R$|.+R\.\d{2}') #Remove 'R' from the end of service replacement part codes
  195.     {
  196.         $part = $part.Replace('R', '')
  197.     }
  198.     if ($part.EndsWith('.01') -or $part -notmatch '.{4,6}\.[A-Z]{3}$') #Add _NOR to non own brand part codes
  199.     {
  200.         $part += '_NOR'
  201.     }
  202.     $part = $part.Replace(".", "_") #Replace dots with underscores (blame Marketing)
  203.     $lblFilter = -join ('*_', $part, '*') #Throw in some super stars (wildcard it) to make a file name filter
  204.    
  205.    
  206.     # Search for label files matching our part number from the label root folder down
  207.     # excluding anything in folders named 'Obsolete'
  208.     $lblFound = Get-ChildItem -File -Path $lblRoot -Recurse -Include *.alf -Filter $lblFilter | Where-Object fullname -NotMatch Obsolete
  209.    
  210.     switch ($lblFound.Count) #Action depends on how many label files we matched
  211.     {
  212.         0 #Did someone steal my label?
  213.         {
  214.             'No labels found for this part - Cannot print'
  215.         }
  216.         1 #Perfect
  217.         {
  218.             "Printing label $lblFound"
  219.             $lblStock = ($lblFound.Name -split "_", 2)[0] #1st part of filename before the "_"
  220.             $lblRows = 1
  221.             if ($lblStock -in $lblDblRow) #How many labels per row?
  222.             {
  223.                 $lblRows = 2
  224.             }
  225.             switch ($lblRows) #Calculate the number of rows of labels to print
  226.             {
  227.                 1 { $printCount = [int16]$origQty }
  228.                 2 { $printCount = [int16][math]::Truncate(($origQty/2) + 0.5) }
  229.             }
  230.             $printString = Read-Printer #Select a printer
  231.             $pfContent  = 'LABELNAME=' + $lblFound.FullName + $crlf
  232.             $pfContent += 'LABELQUANTITY=' + $printCount + $crlf
  233.             $pfContent += $printString + $crlf
  234.            
  235.             $pfName = $monitor + '\' + $worksOrder + '_' + [int16]$origQty + ' x ' + $part + '.acf'
  236.             if (Test-Path -Path $pfName)
  237.             {
  238.                 throw "Fatal error - Another copy of the print instruction file already exists"
  239.             }
  240.            
  241.             # Stream label to destination file
  242.             $stream = New-Object -ComObject ADODB.Stream
  243.             $stream.Charset = "utf-8"
  244.             $stream.Open()
  245.             $stream.WriteText($pfContent)
  246.             $stream.SaveToFile($pfName)
  247.             $stream.Close()
  248.             <# User wants less on-screen feedback
  249.             ''
  250.             "Label $pfName printed to $printing $printString"
  251.             #>
  252.         }
  253.         default #Oops. More than 1 label found
  254.         {
  255.             "Found $($lblFound.Count) labels:"
  256.             $lblFound
  257.             'Cannot print - There can be only one! (label per part number)'
  258.         }
  259.     }
  260.     ''
  261.     ''
  262. }
  263. until ($worksOrder -eq 'X')
  264.  
  265. $conn.Close | Out-Null

Re: Problems installing RSEE on remote PC

Posted: Tue Apr 23, 2019 5:10 am
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 4440 times
So: it's only a warning & not an error, and the event log confirms that the install succeeded.
All now copacetic.