Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update module to work with 11.2 release #271

Closed
jagger opened this issue Apr 25, 2022 · 1 comment · Fixed by #280
Closed

Update module to work with 11.2 release #271

jagger opened this issue Apr 25, 2022 · 1 comment · Fixed by #280
Labels
bug Something isn't working triage needed new issues that are still in state of triage

Comments

@jagger
Copy link
Contributor

jagger commented Apr 25, 2022

Verified issue does not already exist?

Yes

What error did you receive

Search-TssSecret -TssSession $TssSession -verbose

VERBOSE: Command invocation: Search-TssSecret -TssSession:TssSessionObject -Verbose:True
VERBOSE: Performing the operation GET https://labss02.jaggerlab.local/SecretServer/api/v1/secrets?sortBy[0].direction=asc&sortBy[0].name=Name&take=2147483647&filter.includeRestricted=true
InvalidArgument: C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.60.6\functions\secrets\Search-TssSecret.ps1:274:17
Line |
274 | … [Thycotic.PowerShell.Secrets.Summary[]]$restResponse.reco …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot convert value "@{id=65; name=10.10.10.239; secretTemplateId=9; secretTemplateName=Web Password; folderId=46; siteId=1; active=True; checkedOut=False; isRestricted=False;
| isOutOfSync=False; outOfSyncReason=; lastHeartBeatStatus=Disabled; lastPasswordChangeAttempt=1/1/0001 12:00:00 AM; responseCodes=; lastAccessed=4/18/2022 4:39:49 AM; extendedFields=;
| checkOutEnabled=False; autoChangeEnabled=False; doubleLockEnabled=False; requiresApproval=False; requiresComment=False; inheritsPermissions=True; hidePassword=False;
| createDate=9/1/2021 3:37:49 PM; daysUntilExpiration=; hasLauncher=True}" to type "Thycotic.PowerShell.Secrets.Summary". Error: "Cannot convert the "@{id=65; name=10.10.10.239;
| secretTemplateId=9; secretTemplateName=Web Password; folderId=46; siteId=1; active=True; checkedOut=False; isRestricted=False; isOutOfSync=False; outOfSyncReason=;
| lastHeartBeatStatus=Disabled; lastPasswordChangeAttempt=1/1/0001 12:00:00 AM; responseCodes=; lastAccessed=4/18/2022 4:39:49 AM; extendedFields=; checkOutEnabled=False;
| autoChangeEnabled=False; doubleLockEnabled=False; requiresApproval=False; requiresComment=False; inheritsPermissions=True; hidePassword=False; createDate=9/1/2021 3:37:49 PM;
| daysUntilExpiration=; hasLauncher=True}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Secrets.Summary"."

Please run the command using -Verbose

Search-TssSecret -TssSession $TssSession -verbose

VERBOSE: Command invocation: Search-TssSecret -TssSession:TssSessionObject -Verbose:True
VERBOSE: Performing the operation GET https://labss02.jaggerlab.local/SecretServer/api/v1/secrets?sortBy[0].direction=asc&sortBy[0].name=Name&take=2147483647&filter.includeRestricted=true
InvalidArgument: C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.60.6\functions\secrets\Search-TssSecret.ps1:274:17
Line |
274 | … [Thycotic.PowerShell.Secrets.Summary[]]$restResponse.reco …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot convert value "@{id=65; name=10.10.10.239; secretTemplateId=9; secretTemplateName=Web Password; folderId=46; siteId=1; active=True; checkedOut=False; isRestricted=False;
| isOutOfSync=False; outOfSyncReason=; lastHeartBeatStatus=Disabled; lastPasswordChangeAttempt=1/1/0001 12:00:00 AM; responseCodes=; lastAccessed=4/18/2022 4:39:49 AM; extendedFields=;
| checkOutEnabled=False; autoChangeEnabled=False; doubleLockEnabled=False; requiresApproval=False; requiresComment=False; inheritsPermissions=True; hidePassword=False;
| createDate=9/1/2021 3:37:49 PM; daysUntilExpiration=; hasLauncher=True}" to type "Thycotic.PowerShell.Secrets.Summary". Error: "Cannot convert the "@{id=65; name=10.10.10.239;
| secretTemplateId=9; secretTemplateName=Web Password; folderId=46; siteId=1; active=True; checkedOut=False; isRestricted=False; isOutOfSync=False; outOfSyncReason=;
| lastHeartBeatStatus=Disabled; lastPasswordChangeAttempt=1/1/0001 12:00:00 AM; responseCodes=; lastAccessed=4/18/2022 4:39:49 AM; extendedFields=; checkOutEnabled=False;
| autoChangeEnabled=False; doubleLockEnabled=False; requiresApproval=False; requiresComment=False; inheritsPermissions=True; hidePassword=False; createDate=9/1/2021 3:37:49 PM;
| daysUntilExpiration=; hasLauncher=True}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Secrets.Summary"."

Provide a test case or steps to reproduce

search-tsssecret

Expected behavior

A list of secrets should be returned

What Edition of Secret Server?

Platinum

What version of Secret Server

EA release

What PowerShell host was used when producing this error

Windows PowerShell (powershell)

PowerShell Host Version

�[32;1mName Value�[0m
�[32;1m---- -----�[0m
PSVersion 7.2.2
PSEdition Core
GitCommitId 7.2.2
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

@jagger jagger added bug Something isn't working triage needed new issues that are still in state of triage labels Apr 25, 2022
@casorke
Copy link

casorke commented May 12, 2022

This can be resolved at least temporarily by changing both sections that output the $restResponse to parse the API properties and copy them over to a Thycotic.PowerShell.Secrets.Secret class object. One field, 'jumpboxRouteID', is not in the Thycotic.PowerShell.Secrets.Secret class, so it will throw one error in copying the date over.

Here's how I handled it:

if ($restResponse) {
    $TssSecret = [Thycotic.PowerShell.Secrets.Secret]::New()
    ($restResponse | Get-Member -MemberType NoteProperty).Name | Foreach-Object {
        Try {
            $TssSecret.$_ = $restResponse.$_
        } catch [System.Management.Automation.RuntimeException] {
            Continue
        } catch {
            Write-Warning "Issue parsing secret [$secret]"
            $err = $_
            . $ErrorHandling $err
        }
    }
    [Thycotic.PowerShell.Secrets.Secret]$TssSecret
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage needed new issues that are still in state of triage
Projects
None yet
2 participants