Script Packager and Start-Transcript no longer work.

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.
This topic is 2 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
dpdpowered83
Posts: 3
Last visit: Mon Jan 22, 2024 10:28 am

Script Packager and Start-Transcript no longer work.

Post by dpdpowered83 »

Product, version and build: Powershell 2022 Version 5.8.200
Operating system: Developed on Windows 10 Enterprise, Service running on Windows Server 2016
PowerShell version(s): 5.1

I recently upgraded to PowerShell Studio 2022 and needed to re-created a package/executable to run as a Windows Service. The service starts, but when reviewing the log that is created, I see the following:
PS>TerminatingError(Write-Host): "Source property was not set before writing to the event log."
>> TerminatingError(Write-Host): "Source property was not set before writing to the event log."
>> TerminatingError(Write-Host): "Source property was not set before writing to the event log."
Source property was not set before writing to the event log.
**********************
Windows PowerShell transcript end
End time: 20220127140242
**********************

The service continues to run, but nothing is getting logged, which will make things difficult to troubleshoot. I'm using Powershell 5.1 to run the service. I've reverted my changes with an older version of the service executable (that wasn't compiled using Powershell Studio 2022) and the Start-Transcript component is working with no issues. I also ran the PS script from a Powershell console and Start-Transcript worked properly. Any thoughts? Thank you.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Script Packager and Start-Transcript no longer work.

Post by Alexander Riedel »

Start-Transcript is not something we have any control over, that is a PowerShell thing.
From the error message I am not certain if this is a Start-Transcript error or a host error.
In your service, do not call Start-Transcript but do a Write-Host somewhere. Does that show up in the event log or does it produce the same error?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
dpdpowered83
Posts: 3
Last visit: Mon Jan 22, 2024 10:28 am

Re: Script Packager and Start-Transcript no longer work.

Post by dpdpowered83 »

Write-host is also utilize within the service, so start-transcript would capture the write-host entry to file. The event viewer application file is not reliable on this particular server due to the high activity of the file, and entries being overwritten/rotated. I've removed the start-transcript from the service, I just noticed that none of write-host entries are being saved in the application event log file.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Script Packager and Start-Transcript no longer work.

Post by Alexander Riedel »

(that wasn't compiled using Powershell Studio 2022) What was it 'compiled' with?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
dpdpowered83
Posts: 3
Last visit: Mon Jan 22, 2024 10:28 am

Re: Script Packager and Start-Transcript no longer work.

Post by dpdpowered83 »

The service was created/compiled using the SAPIEN Script Packager.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Script Packager and Start-Transcript no longer work.

Post by Alexander Riedel »

The SAPIEN Script Packager has been part of PowerShell Studio and PrimalScript for many years. It is what PowerShell Studio currently uses.
Can you be more specific to the product and version that was used please?
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 2 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.