thycotic-ps / thycotic.secretserver

PowerShell module for automating with Thycotic Secret Server REST API
https://thycotic-ps.github.io/thycotic.secretserver
MIT License
68 stars 22 forks source link

Missing Get-TssInvocation #300

Closed MrM1y4g1 closed 2 years ago

MrM1y4g1 commented 2 years ago

Verified issue does not already exist?

Yes

What error did you receive

PSMessageDetails      : 
Exception             : System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.
                           at CallSite.Target(Closure , CallSite , Object , String )
                           at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject          : 
CategoryInfo          : InvalidOperation: (:) [], RuntimeException
FullyQualifiedErrorId : InvokeMethodOnNull
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at New-TssSession<Process>, C:\Repositories\Automation\modules\Thycotic.SecretServer\functions\authentication\New-TssSession.ps1: line 129
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

Please run the command using -Verbose

`PS C:\Repositories\Automation> $TycoticSession = New-TssSession -SecretServer $TycoticUrl -Credential $TycoticCredentials -verbose InvalidOperation: C:\Repositories\Automation\modules\Thycotic.SecretServer\functions\authentication\New-TssSession.ps1:113:29 Line | 113 | … utputTssSession = [Thycotic.PowerShell.Authentication.Session]::new() | ~~~~~~~~~~~~ | Unable to find type [Thycotic.PowerShell.Authentication.Session].

Get-TssInvocation: C:\Repositories\Automation\modules\Thycotic.SecretServer\functions\authentication\New-TssSession.ps1:117:9 Line | 117 | Get-TssInvocation $PSCmdlet.MyInvocation | ~~~~~ | The term 'Get-TssInvocation' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that | the path is correct and try again.

InvalidOperation: C:\Repositories\Automation\modules\Thycotic.SecretServer\functions\authentication\New-TssSession.ps1:122:13 Line | 122 | $outputTssSession.SecretServer = $SecretServer | ~~~~~~~~~~ | The property 'SecretServer' cannot be found on this object. Verify that the property exists and can be set.

InvalidOperation: C:\Repositories\Automation\modules\Thycotic.SecretServer\functions\authentication\New-TssSession.ps1:129:13 Line | 129 | $outputTssSession.ApiUrl = $outputTssSession.SecretServer … | ~~~~~~~~~~~~~ | You cannot call a method on a null-valued expression.

WARNING: SecretServer argument not found`

Provide a test case or steps to reproduce

  1. Download latest release
  2. Import moduel
  3. Run following code:
    $TycoticUsername = "USERNAME"
    $TycoticPassword = "PASSWORD"
    $TycoticUrl = "https://<customerid>.secretservercloud.eu"
    $TycoticCredentials = [PSCredential]::new( $TycoticUsername, ( ConvertTo-SecureString -String $TycoticPassword -AsPlainText -Force ) )
    $TycoticSession = New-TssSession -SecretServer $TycoticUrl -Credential $TycoticCredentials

Expected behavior

Successfull connection :)

What Edition of Secret Server?

Cloud Subscription

What version of Secret Server

11.0

What PowerShell host was used when producing this error

VS Code (terminal)

PowerShell Host Version

Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
MrM1y4g1 commented 2 years ago

It seems to work when the module resides in the expected module locations except when loading module from a custom directory