diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bdc5ea7a..92f65db82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ No unreleased features ## Released +### v1.9.1 + +#### Bug fixes + +* `Get-C8ySessionProperty` selects first matching Session parameter in the call stack if multiple matches are found + ### v1.9.0 ### New features diff --git a/tools/PSc8y/PSc8y.psd1 b/tools/PSc8y/PSc8y.psd1 index b13508b30..17c6cd36d 100644 --- a/tools/PSc8y/PSc8y.psd1 +++ b/tools/PSc8y/PSc8y.psd1 @@ -12,7 +12,7 @@ RootModule = './PSc8y.psm1' # Version number of this module. -ModuleVersion = '1.9.0' +ModuleVersion = '1.9.1' # Supported PSEditions CompatiblePSEditions = @( diff --git a/tools/PSc8y/Public-manual/Get-C8ySessionProperty.ps1 b/tools/PSc8y/Public-manual/Get-C8ySessionProperty.ps1 index 59d8aa04a..488a1e86e 100644 --- a/tools/PSc8y/Public-manual/Get-C8ySessionProperty.ps1 +++ b/tools/PSc8y/Public-manual/Get-C8ySessionProperty.ps1 @@ -32,8 +32,10 @@ string tenant = $env:C8Y_TENANT } - # Is calling cmdlet using the session variable? - $Session = (Get-PSCallStack).InvocationInfo.BoundParameters.Session - $Values = Get-Session -Session:$Session + $Session = (Get-PSCallStack).InvocationInfo.BoundParameters.Session | Select-Object -First 1 + + if ($Session) { + $Values = Get-Session -Session:$Session + } $Values | Select-Object -ExpandProperty $Name }