Page 1 of 1

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

Posted: Sun Jan 20, 2019 4:17 am
by gaulet
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 2297 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"

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

Posted: Sun Jan 20, 2019 11:11 am
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.

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

Posted: Mon Jan 21, 2019 4:11 am
by gaulet
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 2253 times
Can i keep these files in my environment or it's better to rollback to the previous files ?


regards

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

Posted: Mon Jan 21, 2019 6:18 am
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.

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

Posted: Tue Feb 05, 2019 9:11 am
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/