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

Search-TSSSecret - Thycotic.PowerShell.Secrets.Summary #321

Closed R-STR closed 1 year ago

R-STR commented 1 year ago

Verified issue does not already exist?

Yes

What error did you receive

Error: "Cannot convert the "@{id=; name=; secretTemplateId=; secretTemplateName=; folderId=; folderPath=; siteId=; active=; checkedOut=; isRestricted=; isOutOfSync=;  outOfSyncReason=; lastHeartBeatStatus=; lastPasswordChangeAttempt=; responseCodes=; lastAccessed=; extendedFields=; checkOutEnabled=; autoChangeEnabled=; doubleLockEnabled=; requiresApproval=; requiresComment=; inheritsPermissions=; hidePassword=; createDate=;  daysUntilExpiration=; hasLauncher=}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Secrets.Summary"." At C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.60.8\functions\secrets\Search-TssSecret.ps1:274 char:17

Please run the command using -Verbose

VERBOSE: Command invocation: Search-TssSecret -TssSession:TssSessionObject -FolderId:TssSessionObject -Verbose:True VERBOSE: Filters: filter.folderId= VERBOSE: Performing the operation GET https:// /api/v1/secrets?sortBy[0].direction=asc&sortBy[0].name=Name&take=2147483647&filter.includeRestricted=true&filter.folderId= Cannot convert value

Provide a test case or steps to reproduce

Search-TSSSecret

Expected behavior

Return list of array objects

What Edition of Secret Server?

Cloud Subscription

What version of Secret Server

EA release

What PowerShell host was used when producing this error

Windows PowerShell (powershell)

PowerShell Host Version

5.1

MrM1y4g1 commented 1 year ago

I discovered this issue as well and implemented a quick fix in our cached module, basically we're ignoring the new folderPath that is being returned by the API. An actually fix would be to add the property to the class.

VirtuallyDan commented 1 year ago

I'm hitting this as well. It was working late last week. We are using SS Cloud 11.4.000007

@MrM1y4g1 Can you please share the work around, until we get an official release?

Thx!

MrM1y4g1 commented 1 year ago

Definitely, here's what i did:

functions\secrets\Search-TssSecret.ps1:274

Changed from: [Thycotic.PowerShell.Secrets.Summary[]] $restResponse.records

Changed to: [Thycotic.PowerShell.Secrets.Summary[]] ($restResponse.records | Select-Object -ExcludeProperty "folderPath")

I more or less believe i have a fix for this issue though i'm having trouble getting the library to build correctly using the readme.

VirtuallyDan commented 1 year ago

That works like a Champ!

Thx for the quick reply!

MrM1y4g1 commented 1 year ago

Awesome, glad it worked for you!

R-STR commented 1 year ago

Perfect, thank you kindly!

tylerezimmerman commented 1 year ago

@MrM1y4g1 we merged in and released your PR for this #305 , can this issue be considered resolved?

wlodge-WM commented 1 year ago

This was still broken for me. I also found that I couldn't simply exclude the "folderPath" property, as mentioned above; I still got the same error. I ended up modifying the same line (274), but selected only a subset of the parameters: [Thycotic.PowerShell.Secrets.Summary[]] ($restResponse.records | Select-Object ID, Name, SecretName, FolderID, SecretTemplateName, Active, LastHeartbeatStatus, LastPasswordChangeAttempt, DaysUntilExpiration)

Please provide an official fix on this issue.

rkendrick486 commented 1 year ago

Came here to state this is still a problem for me after updating. The above suggestions worked as a band-aid.

wlodge-WM commented 1 year ago

OK so my code above neuters the output much more than is necessary. @MrM1y4g1 had the right idea, but it was missing the "" after Select-Object, so it didn't work for me originally. Adding that in works. Line 274 should instead read: [Thycotic.PowerShell.Secrets.Summary[]] ($restResponse.records | Select-Object -ExcludeProperty folderPath)

wlodge-WM commented 1 year ago

This appears to be resolved as of 0.61.0. Thank you!