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

Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum 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
gaulet
Posts: 10
Joined: Wed Jun 29, 2016 12:37 am

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

Post by gaulet » Sun Jan 20, 2019 4:17 am

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

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

Post by Alexander Riedel » Sun Jan 20, 2019 11:11 am

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
gaulet
Posts: 10
Joined: Wed Jun 29, 2016 12:37 am

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

Post by gaulet » Mon Jan 21, 2019 4:11 am

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

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

Post by Alexander Riedel » Mon Jan 21, 2019 6:18 am

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: 5726
Joined: Thu Aug 18, 2011 4:56 am

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

Post by davidc » Tue Feb 05, 2019 9:11 am

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.