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

Search-TssUser | Search-TssSecretDependency | Search-TssGroup | Search-TssRole cannot convert value #288

Closed
d1d3m opened this issue Jul 22, 2022 · 0 comments · Fixed by #289
Labels
bug Something isn't working triage needed new issues that are still in state of triage

Comments

@d1d3m
Copy link

d1d3m commented Jul 22, 2022

Verified issue does not already exist?

Yes

What error did you receive

PSMessageDetails :
Exception : System.Management.Automation.RuntimeException: Cannot convert value "@{id=1; name=Administrator; enabled=True; created=2018-01-29T17:38:14.313; isSystem=False}" to type
"Thycotic.PowerShell.Roles.Role". Error: "Cannot convert the "@{id=1; name=Administrator; enabled=True; created=2018-01-29T17:38:14.313; isSystem=False}" value of type
"System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Roles.Role"." ---> System.Management.Automation.PSInvalidCastException: Cannot convert value "@{id=1;
name=Administrator; enabled=True; created=2018-01-29T17:38:14.313; isSystem=False}" to type "Thycotic.PowerShell.Roles.Role". Error: "Cannot convert the "@{id=1; name=Administrator;
enabled=True; created=2018-01-29T17:38:14.313; isSystem=False}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Roles.Role"." --->
System.Management.Automation.PSInvalidCastException: Cannot convert the "@{id=1; name=Administrator; enabled=True; created=2018-01-29T17:38:14.313; isSystem=False}" value of type
"System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Roles.Role". ---> System.InvalidOperationException: The isSystem property was not found for the
Thycotic.PowerShell.Roles.Role object. The available property is: [RoleId <System.Int32>] , [RoleName <System.String>] , [Created <System.Nullable1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [Enabled <System.Boolean>] , [Id <System.Int32>] , [Name <System.String>] 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.ConversionData1.Invoke(Object valueToConvert, Type resultType, Boolean recurse, 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 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 : InvalidCastConstructorException
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Search-TssRole, C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.60.7\functions\roles\Search-TssRole.ps1: line 101
at , : line 1
PipelineIterationInfo : {}

Please run the command using -Verbose

Command invocation: Search-TssRole -Verbose:True -TssSession:TssSessionObject
Performing the operation GET https://picanolgroup.secretservercloud.eu/api/v1/roles?sortBy[0].direction=asc&sortBy[0].name=Name&take=2147483647 with:
Cannot convert value "@{id=1; name=Administrator; enabled=True; created=2018-01-29T17:38:14.313; isSystem=False}" to type "Thycotic.PowerShell.Roles.Role". Error: "Cannot convert the "@{id=1;
name=Administrator; enabled=True; created=2018-01-29T17:38:14.313; isSystem=False}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Roles.Role"."
At C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.60.7\functions\roles\Search-TssRole.ps1:101 char:17

  • ... [Thycotic.PowerShell.Roles.Role[]]$restResponse.records
  •               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvalidCastConstructorException

Provide a test case or steps to reproduce

Search-TssUser
Search-TssSecretDependency
Search-TssGroup
Search-TssRole

Expected behavior

Return a proper object of the requested type.

Seems several objects within the Secrect Server has been extended additional properties, but the Thycotic.SecretServer PowerShell module works with static defined PScustomObjects. So those CmdLets do fail because of an object mismatch. Within the CmdLets that fail are some basic once, what's not realy convenient do address some PowerShell automation.

Below the outcome some test with the types that fail. It didn't cover all and could be that more then one property is missing.

[Thycotic.PowerShell.Configuration.Audit] > okay
[Thycotic.PowerShell.DirectoryServices.DomainSummary] > okay
[Thycotic.PowerShell.DirectoryServices.Group] > okay
[Thycotic.PowerShell.DirectoryServices.GroupMember] > okay
[Thycotic.PowerShell.DistributedEngines.EngineSummary] > doesn't contain the 'timeMismatch' property
[Thycotic.PowerShell.DistributedEngines.SiteConnectorSummary] > okay
[Thycotic.PowerShell.DistributedEngines.SiteSummary] > okay
[Thycotic.PowerShell.EventPipeline.Summary] > okay
[Thycotic.PowerShell.EventPipelinePolicy.List] > okay
[Thycotic.PowerShell.Folders.Summary] > okay
[Thycotic.PowerShell.FolderPermissions.Permission] > okay
[Thycotic.PowerShell.Groups.Summary] > doesn't contain the 'isPlatform' property
[Thycotic.PowerShell.IpRestrictions.IpRestriction] > okay
[Thycotic.PowerShell.Lists.Summary] > okay
[Thycotic.PowerShell.Roles.Role] > doesn't contain the 'isSystem' property
[Thycotic.PowerShell.Scripts.Summary] > okay
[Thycotic.PowerShell.SecretDependencies.Summary] > doesn't contain the 'canTest' property
[Thycotic.PowerShell.SecretPermissions.Permission] > okay
[Thycotic.PowerShell.SecretPolicies.Summary] > okay
[Thycotic.PowerShell.SecretTemplates.Summary] > okay
[Thycotic.PowerShell.Diagnostics.SystemLog] > okay
[Thycotic.PowerShell.Users.Summary] > doesn't contain the 'platformIntegrationType' property
[Thycotic.PowerShell.WorkflowTemplates.Detail] > okay

What Edition of Secret Server?

Platinum

What version of Secret Server

11.0

What PowerShell host was used when producing this error

Windows PowerShell ISE (powershell_ise)

PowerShell Host Version

Seems not to matter. Issue also occurs within other PowerShell hosts.

Name Value


PSVersion 5.1.19041.1682
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1682
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

@d1d3m d1d3m added bug Something isn't working triage needed new issues that are still in state of triage labels Jul 22, 2022
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

Successfully merging a pull request may close this issue.

1 participant