Get-ScriptDirectory function / snippet not working since last update SPS19Setup_5.6.157_011419_x64

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 5 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
Gauletga
Posts: 11
Last visit: Sun Mar 10, 2024 8:16 am

Get-ScriptDirectory function / snippet not working since last update SPS19Setup_5.6.157_011419_x64

Post by Gauletga »

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.157
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.16299.0

Since last update when i utilise the snippet Get-ScriptDirectory

Code: Select all

function Get-ScriptDirectory
{
	[OutputType([string])]
	param ()
	if ($null -ne $hostinvocation)
	{
		Split-Path $hostinvocation.MyCommand.path
	}
	else
	{
		Split-Path $script:MyInvocation.MyCommand.Path
	}
}

$hostinvocation
$ScriptDirectory = Get-ScriptDirectory
$ScriptDirectory
hostinvocation return
hostinvocation.PNG
hostinvocation.PNG (620 Bytes) Viewed 3420 times
Get-ScriptDirectory return (sorry it's in french but we cqan see the issue

Code: Select all

ERROR: Split-Path : Impossible de lier l'argument au paramètre « Path », car il a la valeur Null.
ERROR: Au caractère C:\Users\<username>\Documents\SAPIEN\PowerShell Studio\Files\test9.ps1:31 : 14
ERROR: +         Split-Path $hostinvocation.MyCommand.path
ERROR: +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR:     + CategoryInfo          : InvalidData : (:) [Split-Path], ParameterBindingValidationException
ERROR:     + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.SplitPathCommand
ERROR:
the issue only happen when i'm inside powershell studio and run in the default output.
When i run in console it return something like this (yes with the pointy at the beginning of the line)
."C:\Users\<username>\Documents\SAPIEN\PowerShell Studio\Files\test9.ps1"
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Get-ScriptDirectory function / snippet not working since last update SPS19Setup_5.6.157_011419_x64

Post by Alexander Riedel »

Download this file:
https://sapien.s3.amazonaws.com/downloa ... 202019.zip

Replace the files here with the content of the zip: C:\Program Files (x86)\Common Files\SAPIEN Debugger 2019

Please make a backup of the original files first and let us know if this solves the problem.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Gauletga
Posts: 11
Last visit: Sun Mar 10, 2024 8:16 am

Re: Get-ScriptDirectory function / snippet not working since last update SPS19Setup_5.6.157_011419_x64

Post by Gauletga »

Hello

With the files replaced this is the result

Code: Select all

>> Platform: V5 64Bit
>> Analyzing Script (Results in Tools Output panel)...
Hostinvocation:  DebuggerNameSpace.HostInvocationInfo
Hostinvocation.MyCommand:  C:\Users\<username>\Documents\SAPIEN\PowerShell Studio\Files\test9.ps1
Hostinvocation.MyCommand.Name:  test9.ps1
ScriptDirectory: C:\Users\<username>\Documents\SAPIEN\PowerShell Studio\Files
ScriptName: test9.ps1
For information, the file you send triggerred the Windows Defender Smartscreen
debugger smart defender.PNG
debugger smart defender.PNG (16.82 KiB) Viewed 3376 times
Can i keep these files in my environment or it's better to rollback to the previous files ?


regards
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Get-ScriptDirectory function / snippet not working since last update SPS19Setup_5.6.157_011419_x64

Post by Alexander Riedel »

That's because the files are not signed. You can keep them, of course. You may have to remove them manually if the next update does not replace them automatically and re-install. Sorry for any inconvenience.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Get-ScriptDirectory function / snippet not working since last update SPS19Setup_5.6.157_011419_x64

Post by davidc »

We released the 5.6.158 service build that resolves this issue:

https://www.sapien.com/blog/2019/02/05/ ... -v5-6-158/
David
SAPIEN Technologies, Inc.
This topic is 5 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.