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

Get-TssFolder fails on casting [System.Management.Automation.PSCustomObject] to [Thycotic.PowerShell.Folders.FolderTemplate] #409

Open
dirtdonthurt opened this issue Oct 17, 2024 · 0 comments
Labels
bug Something isn't working triage needed new issues that are still in state of triage

Comments

@dirtdonthurt
Copy link

Verified issue does not already exist?

Yes

What error did you receive

PSMessageDetails :
Exception : System.Management.Automation.RuntimeException: Cannot convert value "@{id=4145; folderName=Default Import Folder; folderPath=\Server Infrastructure\Default Import Folder;
parentFolderId=983; folderTypeId=1; secretPolicyId=3; inheritSecretPolicy=False; inheritPermissions=False; childFolders=; secretTemplates=System.Object[]}" to type
"Thycotic.PowerShell.Folders.Folder[]". Error: "Cannot create object of type "Thycotic.PowerShell.Folders.Folder". Cannot convert value "@{id=6051; name=_DTV Web Password; secretCount=0;
active=True; passwordTypeId=31; heartbeatEnabled=False; passwordTypeReady=False}" to type "Thycotic.PowerShell.Folders.FolderTemplate". Error: "Cannot convert the "@{id=6051; name=_DTV
Web Password; secretCount=0; active=True; passwordTypeId=31; heartbeatEnabled=False; passwordTypeReady=False}" value of type "System.Management.Automation.PSCustomObject" to type
"Thycotic.PowerShell.Folders.FolderTemplate".""
---> System.Management.Automation.PSInvalidCastException: Cannot convert value "@{id=4145; folderName=Default Import Folder; folderPath=\Server Infrastructure\Default Import Folder;
parentFolderId=983; folderTypeId=1; secretPolicyId=3; inheritSecretPolicy=False; inheritPermissions=False; childFolders=; secretTemplates=System.Object[]}" to type
"Thycotic.PowerShell.Folders.Folder[]". Error: "Cannot create object of type "Thycotic.PowerShell.Folders.Folder". Cannot convert value "@{id=6051; name=_DTV Web Password; secretCount=0;
active=True; passwordTypeId=31; heartbeatEnabled=False; passwordTypeReady=False}" to type "Thycotic.PowerShell.Folders.FolderTemplate". Error: "Cannot convert the "@{id=6051; name=_DTV
Web Password; secretCount=0; active=True; passwordTypeId=31; heartbeatEnabled=False; passwordTypeReady=False}" value of type "System.Management.Automation.PSCustomObject" to type
"Thycotic.PowerShell.Folders.FolderTemplate".""
---> System.Management.Automation.PSInvalidCastException: Cannot create object of type "Thycotic.PowerShell.Folders.Folder". Cannot convert value "@{id=6051; name=_DTV Web Password;
secretCount=0; active=True; passwordTypeId=31; heartbeatEnabled=False; passwordTypeReady=False}" to type "Thycotic.PowerShell.Folders.FolderTemplate". Error: "Cannot convert the
"@{id=6051; name=_DTV Web Password; secretCount=0; active=True; passwordTypeId=31; heartbeatEnabled=False; passwordTypeReady=False}" value of type
"System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Folders.FolderTemplate"."
---> System.Management.Automation.PSInvalidCastException: Cannot convert value "@{id=6051; name=_DTV Web Password; secretCount=0; active=True; passwordTypeId=31; heartbeatEnabled=False;
passwordTypeReady=False}" to type "Thycotic.PowerShell.Folders.FolderTemplate". Error: "Cannot convert the "@{id=6051; name=_DTV Web Password; secretCount=0; active=True;
passwordTypeId=31; heartbeatEnabled=False; passwordTypeReady=False}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Folders.FolderTemplate"."
---> System.Management.Automation.PSInvalidCastException: Cannot convert the "@{id=6051; name=_DTV Web Password; secretCount=0; active=True; passwordTypeId=31; heartbeatEnabled=False;
passwordTypeReady=False}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Folders.FolderTemplate".
---> System.InvalidOperationException: The property 'passwordTypeId' was not found for the 'Thycotic.PowerShell.Folders.FolderTemplate' object. The settable properties are: [Id
<System.Int32>], [Name <System.String>], [SecretCount <System.Int32>], [Active <System.Boolean>].
at System.Management.Automation.LanguagePrimitives.CreateMemberNotFoundError(PSObject pso, DictionaryEntry property, Type resultType)
at System.Management.Automation.LanguagePrimitives.SetObjectProperties(Object o, IDictionary properties, Type resultType, MemberNotFoundError memberNotFoundErrorAction,
MemberSetValueError memberSetValueErrorAction, Boolean enableMethodCall, IFormatProvider formatProvider, Boolean recursion, Boolean ignoreUnknownMembers)
at System.Management.Automation.LanguagePrimitives.SetObjectProperties(Object o, PSObject psObject, Type resultType, MemberNotFoundError memberNotFoundErrorAction, MemberSetValueError
memberSetValueErrorAction, IFormatProvider formatProvider, Boolean recursion, Boolean ignoreUnknownMembers)
--- End of inner exception stack trace ---
at System.Management.Automation.LanguagePrimitives.SetObjectProperties(Object o, PSObject psObject, Type resultType, MemberNotFoundError memberNotFoundErrorAction, MemberSetValueError
memberSetValueErrorAction, IFormatProvider formatProvider, Boolean recursion, Boolean ignoreUnknownMembers)
at System.Management.Automation.LanguagePrimitives.ConvertViaNoArgumentConstructor.Convert(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert,
IFormatProvider formatProvider, TypeTable backupTable, Boolean ignoreUnknownMembers)
--- End of inner exception stack trace ---
at System.Management.Automation.LanguagePrimitives.ConvertViaNoArgumentConstructor.Convert(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert,
IFormatProvider formatProvider, TypeTable backupTable, Boolean ignoreUnknownMembers)
at System.Management.Automation.LanguagePrimitives.ConvertViaNoArgumentConstructor.Convert(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert,
IFormatProvider formatProvider, TypeTable backupTable)
at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, Boolean recursion, IFormatProvider formatProvider, TypeTable backupTypeTable)
at System.Management.Automation.LanguagePrimitives.ConvertUnrelatedArrays(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider
formatProvider, TypeTable backupTable)
at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, Boolean recursion, IFormatProvider formatProvider, TypeTable backupTypeTable)
at System.Management.Automation.Adapter.PropertySetAndMethodArgumentConvertTo(Object valueToConvert, Type resultType, IFormatProvider formatProvider)
at System.Management.Automation.Adapter.BasePropertySet(PSProperty property, Object setValue, Boolean convert)
--- End of inner exception stack trace ---
at System.Management.Automation.LanguagePrimitives.ConvertViaNoArgumentConstructor.Convert(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert,
IFormatProvider formatProvider, TypeTable backupTable, Boolean ignoreUnknownMembers)
at System.Management.Automation.LanguagePrimitives.ConvertViaNoArgumentConstructor.Convert(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert,
IFormatProvider formatProvider, TypeTable backupTable)
at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, Boolean recursion, IFormatProvider formatProvider, TypeTable backupTypeTable)
at System.Management.Automation.LanguagePrimitives.ConvertScalarToArray(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider
formatProvider, TypeTable backupTable)
--- End of inner exception stack trace ---
at System.Management.Automation.LanguagePrimitives.ConvertScalarToArray(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider
formatProvider, TypeTable backupTable)
at CallSite.Target(Closure, CallSite, Object)
at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
--- End of inner exception stack trace ---
TargetObject :
CategoryInfo : InvalidArgument: (:) [], RuntimeException
FullyQualifiedErrorId : InvalidCastExceptionScalarToArray
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Get-TssFolder, C:\Users\d452254\Documents\PowerShell\Modules\Thycotic.SecretServer\0.61.5\functions\folders\Get-TssFolder.ps1: line 132
at , : line 1
PipelineIterationInfo : {}

Please run the command using -Verbose

PS C:\Users\d452254> Get-TssFolder -id 4145 -IncludeTemplate -TssSession $session -verbose
VERBOSE: Performing the operation GET https://directv.secretservercloud.com/api/v1/folders/4145?getAllChildren=False&includeAssociatedTemplates=True
InvalidArgument: C:\Users\d452254\Documents\PowerShell\Modules\Thycotic.SecretServer\0.61.5\functions\folders\Get-TssFolder.ps1:132
Line |
132 | … [Thycotic.PowerShell.Folders.Folder[]]$restResponse
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot convert value "@{id=4145; folderName=Default Import Folder; folderPath=\Server Infrastructure\Default Import Folder; parentFolderId=983; folderTypeId=1; secretPolicyId=3; inheritSecretPolicy=False;
| inheritPermissions=False; childFolders=; secretTemplates=System.Object[]}" to type "Thycotic.PowerShell.Folders.Folder[]". Error: "Cannot create object of type "Thycotic.PowerShell.Folders.Folder". Cannot
| convert value "@{id=6051; name=_DTV Web Password; secretCount=0; active=True; passwordTypeId=31; heartbeatEnabled=False; passwordTypeReady=False}" to type "Thycotic.PowerShell.Folders.FolderTemplate".
| Error: "Cannot convert the "@{id=6051; name=_DTV Web Password; secretCount=0; active=True; passwordTypeId=31; heartbeatEnabled=False; passwordTypeReady=False}" value of type
| "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Folders.FolderTemplate".""

Provide a test case or steps to reproduce

Get-TssFolder -id 4145 -IncludeTemplate -TssSession $session -verbose

Expected behavior

Folder object is returned including allowed templates

What Edition of Secret Server?

Cloud Subscription

What version of Secret Server

Secret Server Cloud

What PowerShell host was used when producing this error

PowerShell Core (pwsh)

PowerShell Host Version

PS /opt/git/secretserver-integrations> Get-InstalledModule Thycotic.SecretServer

Version Name Repository Description


0.61.8 Thycotic.SecretServer PSGallery Interact with the Secret Server REST API

PS /opt/git/secretserver-integrations> $psversionTable

Name Value


PSVersion 7.4.5
PSEdition Core
GitCommitId 7.4.5
OS Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

@dirtdonthurt dirtdonthurt added bug Something isn't working triage needed new issues that are still in state of triage labels Oct 17, 2024
gaurava-delinea added a commit to gaurava-delinea/thycotic.secretserver that referenced this issue Nov 29, 2024
tylerezimmerman pushed a commit that referenced this issue Dec 2, 2024
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
Development

No branches or pull requests

1 participant