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 SUBSCRIPTION NUMBERS, LICENSE 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 » Mon Apr 22, 2019 7:08 am

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: 7049
Joined: Tue May 29, 2007 4:43 pm

Re: Problems installing RSEE on remote PC

Post by Alexander Riedel » Mon Apr 22, 2019 7:32 am

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

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 » Mon Apr 22, 2019 1:10 pm

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.

Code: Select all

<# Commented out - feedback not currently required
'' # A bit of feedback
'----------------------------------------------------------------------------------------'
"Works Order : $wo Part Number: $part Sales Order: $so Customer: $cust"
"Qty : $origqty"
"Done Date : $donedate"
"Status : $status"
''
#>
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 » Mon Apr 22, 2019 1:28 pm

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 » Mon Apr 22, 2019 2:20 pm

All good on the Win7 PC as well.
In case it's of any use, here's the script:

Code: Select all

<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.95
Created on: 03/08/2015 18:55

Created by: Phil Sharpe
Organization: Norbar Torque Tools Ltd.
Filename: Print-BoxLabel.ps1
===========================================================================
.DESCRIPTION
Print Kiaro box labels from Works Order details.
Currently runs on Windows 7 SP1 / Windows 10 (PowerShell 4 or above)
- untested on anything else.
PrintServer PC is hardcoded to NBW001124.
It is not advisable to run from any other PC without checking the label stock loaded in each printer.

SQL Server is Microsoft SQL Server 2008 Standard Edition (64-bit)

Program Inputs:
1. Works order number (scanned from barcode)
The inventory code and req'd qty are retrieved from the
Norbar_Production database using the W/O number.
Function: Read-WO
2. Printer number - currently 1, 2 or 3.
Function: Read-Printer
Used to construct the printer name

For an audible warning of invalid input data, the Windows system
sound "Question" (not normally used) should be set to a suitable
WAV file. Currently set to a WWII submarine dive alarm.
#>

Add-Type -AssemblyName System.Data

function Show-ErrorBox ($errTitle, $errMsg)
{
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
[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
}

function Read-WO
{
# Enter Works Order number
# This must start with 3 followed by 6 digits
$iWarning = 'Enter Works Order number (x to end)'
$badInput = $false
Do
{
if ($badInput)
{
[System.Media.SystemSounds]::Question.Play() | Out-Null
}
[string]$worksOrder = (Read-Host -Prompt $iWarning).Replace(" ", "").ToUpper()
if ($worksOrder -eq "X")
{
Return "X"
}
$iWarning = 'Invalid Works Order. Please re-enter Works Order (x to end)'
$badInput = $true
}
while ($worksOrder -notmatch '^3\d{6}$')
Return $worksOrder
}

function Read-Printer
{
# Enter Printer number
# Currently this must be 1, 2 or 3
$iWarning = 'Enter Kiaro Printer number (1, 2 or 3)'
$badInput = $false
Do
{
if ($badInput)
{
[System.Media.SystemSounds]::Question.Play() | Out-Null
}
[string]$iPrinter = (Read-Host -Prompt $iWarning).Replace(" ", "")
$iWarning = 'Invalid Printer number. Please enter 1, 2 or 3'
$badInput = $true
}
while ($iPrinter -notin '1', '2', '3')

$iPS = "PRINTER=QuickLabel Kiaro ;Kiaro!" #Base printer name
switch ($iPrinter)
{
1 { $iPS = $iPS.Replace(" ;", " 1;") }
2 { $iPS = $iPS.Replace(" ;", " 2;") }
3 { $iPS = $iPS.Replace(" ;", " 3;") }
}
Return $iPS
}


# Processing starts here

#region Initialize

#The QuickCommand process on the print server monitors the Monitor$ share for new print command files
$printSrvr = 'NBW001124' #PC with QuickCommand & Kiaros connected
$quickCommand = 'C:\Program Files (x86)\Custom QuickLabel\QuickCommand.exe'
if ($env:COMPUTERNAME -ine $printSrvr)
{
#Firing up QuickCommand remotely - Hope you know what you're doing!
$printing = "Remote"
$quickCommand += ' /S'
if ((Get-CimInstance -Query 'Select * from Win32_Process where name like "quickcommand%"' -ComputerName $printSrvr | Measure-Object).Count -eq 0)
{
Invoke-CimMethod –ClassName Win32_Process -Computer $printSrvr –Method "Create" –Arg @{ CommandLine = $quickCommand }
}
$monitor = '\\NBW001124\Monitor$' #This is a pre-created invisible share
}
else
{
#We're running locally - Much safer (in terms of fewer scrapped labels)
$printing = "Local"
if ((Get-Process | Where-Object Name -eq quickcommand).Count -eq 0)
{
Start-Process -FilePath $quickCommand -ArgumentList '/S'
}
$monitor = 'C:\Users\Public\Documents\Custom QuickLabel\QuickCommand\Monitor'
}

$lblRoot = "\\FS1\AssyLabels\ALF Files\Kiaro" #Root folder for our label files
if ((Test-Path -Path $lblRoot -PathType Container) -eq $false)
{
$lblRoot = "\\FS2\AssyLabels\ALF Files\Kiaro"
if ((Test-Path -Path $lblRoot -PathType Container) -eq $false)
{
throw "Fatal error - Cannot access label folder"
}
}

$lblDblRow = @('26771', '26773', '26981', '266105') #Label stock with 2 labels per row
$crlf = [char]13 + [char]10

#Set up database access
$dbUser = "UID=*******"
$dbPass = "Pwd=**************"
$server = "Server=dbserv"
$database = "Database=NORBAR_PRODUCTION"
$conn = New-Object System.Data.SqlClient.SqlConnection("$server;$database;$dbUser;$dbPass")
$conn.Open() | Out-Null
#endregion


do
{
$worksOrder = Read-WO #Get works order number
if ($worksOrder -eq 'X')
{
continue
}

#SQL query
$query = @'
SELECT [WOR_ORDER]
,[WOR_ITEM_ONLY]
,[WOR_SALORD]
,[WOR_CUSTOMER]
,[WOR_ORIG_QTY]
,[WOR_DONE_DATE]
,[WOR_STATUS]
FROM [NORBAR_PRODUCTION].[dbo].[vwASC_WORTBL]
WHERE WOR_ORDER = {0}
'@ -f "'" + $worksOrder + "'"

$command = New-Object System.Data.Sqlclient.SqlCommand($query)
$command.Connection = $conn
$DR = $command.Executereader()
$DR.Read() | Out-Null
$wo = $DR.GetValue(0) # Works order number
$part = $DR.GetValue(1) # Part number
$so = $DR.GetValue(2) # Sales order number
$cust = $DR.GetValue(3) # Customer code
$origQty = $DR.GetValue(4) # Qty reqd
$doneDate = $DR.GetValue(5) # Date the W/O was closed (should be empty)
$status = $DR.GetValue(6) # Open/Closed status
$DR.Close()

<# Commented out - feedback not currently required
'' # A bit of feedback
'----------------------------------------------------------------------------------------'
"Works Order : $wo Part Number: $part Sales Order: $so Customer: $cust"
"Qty : $origqty"
"Done Date : $donedate"
"Status : $status"
''
#>

# Dealing with our "special" way of numbering parts
# and our "unique" way of naming labels, e.g. "26671_13070_NOR Iss1 Apr09.alf"
$part = $part.Trim().ToUpper() #Convert to uppercase without spaces
if ($part -match '^.{4,6}R$|.+R\.\d{2}') #Remove 'R' from the end of service replacement part codes
{
$part = $part.Replace('R', '')
}
if ($part.EndsWith('.01') -or $part -notmatch '.{4,6}\.[A-Z]{3}$') #Add _NOR to non own brand part codes
{
$part += '_NOR'
}
$part = $part.Replace(".", "_") #Replace dots with underscores (blame Marketing)
$lblFilter = -join ('*_', $part, '*') #Throw in some super stars (wildcard it) to make a file name filter


# Search for label files matching our part number from the label root folder down
# excluding anything in folders named 'Obsolete'
$lblFound = Get-ChildItem -File -Path $lblRoot -Recurse -Include *.alf -Filter $lblFilter | Where-Object fullname -NotMatch Obsolete

switch ($lblFound.Count) #Action depends on how many label files we matched
{
0 #Did someone steal my label?
{
'No labels found for this part - Cannot print'
}
1 #Perfect
{
"Printing label $lblFound"
$lblStock = ($lblFound.Name -split "_", 2)[0] #1st part of filename before the "_"
$lblRows = 1
if ($lblStock -in $lblDblRow) #How many labels per row?
{
$lblRows = 2
}
switch ($lblRows) #Calculate the number of rows of labels to print
{
1 { $printCount = [int16]$origQty }
2 { $printCount = [int16][math]::Truncate(($origQty/2) + 0.5) }
}
$printString = Read-Printer #Select a printer
$pfContent = 'LABELNAME=' + $lblFound.FullName + $crlf
$pfContent += 'LABELQUANTITY=' + $printCount + $crlf
$pfContent += $printString + $crlf

$pfName = $monitor + '\' + $worksOrder + '_' + [int16]$origQty + ' x ' + $part + '.acf'
if (Test-Path -Path $pfName)
{
throw "Fatal error - Another copy of the print instruction file already exists"
}

# Stream label to destination file
$stream = New-Object -ComObject ADODB.Stream
$stream.Charset = "utf-8"
$stream.Open()
$stream.WriteText($pfContent)
$stream.SaveToFile($pfName)
$stream.Close()
<# User wants less on-screen feedback
''
"Label $pfName printed to $printing $printString"
#>
}
default #Oops. More than 1 label found
{
"Found $($lblFound.Count) labels:"
$lblFound
'Cannot print - There can be only one! (label per part number)'
}
}
''
''
}
until ($worksOrder -eq 'X')

$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 » Tue Apr 23, 2019 5:10 am

(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 1005 times
So: it's only a warning & not an error, and the event log confirms that the install succeeded.
All now copacetic.